Fixed pagedown button to trigger realtime synchronization
This commit is contained in:
parent
7eaeb45806
commit
e1ab1cbca8
29
js/core.js
29
js/core.js
@ -316,23 +316,18 @@ define([
|
|||||||
$(".wmd-button-row").addClass("btn-group").find("li:not(.wmd-spacer)").addClass("btn").css("left", 0).find("span").hide();
|
$(".wmd-button-row").addClass("btn-group").find("li:not(.wmd-spacer)").addClass("btn").css("left", 0).find("span").hide();
|
||||||
|
|
||||||
// Add customized buttons
|
// Add customized buttons
|
||||||
$("#wmd-bold-button").append($("<i>").addClass("icon-bold"));
|
$("#wmd-bold-button").append($('<i class="icon-bold">'));
|
||||||
$("#wmd-italic-button").append($("<i>").addClass("icon-italic"));
|
$("#wmd-italic-button").append($('<i class="icon-italic">'));
|
||||||
$("#wmd-link-button").append($("<i>").addClass("icon-globe"));
|
$("#wmd-link-button").append($('<i class="icon-globe">'));
|
||||||
$("#wmd-quote-button").append($("<i>").addClass("icon-indent-left"));
|
$("#wmd-quote-button").append($('<i class="icon-indent-left">'));
|
||||||
$("#wmd-code-button").append($("<i>").addClass("icon-code"));
|
$("#wmd-code-button").append($('<i class="icon-code">'));
|
||||||
$("#wmd-image-button").append($("<i>").addClass("icon-picture"));
|
$("#wmd-image-button").append($('<i class="icon-picture">'));
|
||||||
$("#wmd-olist-button").append($("<i>").addClass("icon-numbered-list"));
|
$("#wmd-olist-button").append($('<i class="icon-numbered-list">'));
|
||||||
$("#wmd-ulist-button").append($("<i>").addClass("icon-list"));
|
$("#wmd-ulist-button").append($('<i class="icon-list">'));
|
||||||
$("#wmd-heading-button").append($("<i>").addClass("icon-text-height"));
|
$("#wmd-heading-button").append($('<i class="icon-text-height">'));
|
||||||
$("#wmd-hr-button").append($("<i>").addClass("icon-hr"));
|
$("#wmd-hr-button").append($('<i class="icon-hr">'));
|
||||||
// Create additional undo/redo button for real time synchronization
|
$("#wmd-undo-button").append($('<i class="icon-undo">'));
|
||||||
var realtimeUndoButton = $('<li class="btn hide" id="wmd-undo-button-realtime" title="Undo - Ctrl+Z" style="left: 0px;">');
|
$("#wmd-redo-button").append($('<i class="icon-share-alt">'));
|
||||||
realtimeUndoButton.append($("<i>").addClass("icon-undo"));
|
|
||||||
$("#wmd-undo-button").append($("<i>").addClass("icon-undo")).after(realtimeUndoButton);
|
|
||||||
var realtimeRedoButton = $('<li class="btn hide" id="wmd-redo-button-realtime" title="Redo - Ctrl+Shift+Z" style="left: 0px;">');
|
|
||||||
realtimeRedoButton.append($("<i>").addClass("icon-share-alt"));
|
|
||||||
$("#wmd-redo-button").append($("<i>").addClass("icon-share-alt")).after(realtimeRedoButton);
|
|
||||||
|
|
||||||
extensionMgr.onFileOpen(fileDesc);
|
extensionMgr.onFileOpen(fileDesc);
|
||||||
};
|
};
|
||||||
|
@ -1397,6 +1397,7 @@
|
|||||||
|
|
||||||
if (!noCleanup) {
|
if (!noCleanup) {
|
||||||
fixupInputArea();
|
fixupInputArea();
|
||||||
|
inputBox.dispatchEvent(new Event('input'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -287,20 +287,19 @@ define([
|
|||||||
string.addEventListener(gapi.drive.realtime.EventType.TEXT_DELETED, debouncedRefreshPreview);
|
string.addEventListener(gapi.drive.realtime.EventType.TEXT_DELETED, debouncedRefreshPreview);
|
||||||
debouncedRefreshPreview();
|
debouncedRefreshPreview();
|
||||||
|
|
||||||
// Add event handler for UndoRedoStateChanged events.
|
// Save undo/redo buttons actions
|
||||||
undoExecute = editor.uiManager.buttons.undo.execute;
|
undoExecute = editor.uiManager.buttons.undo.execute;
|
||||||
redoExecute = editor.uiManager.buttons.redo.execute;
|
redoExecute = editor.uiManager.buttons.redo.execute;
|
||||||
|
|
||||||
// var undoButton = $('#wmd-undo-button-realtime').removeClass("hide");
|
// Set new actions for undo/redo buttons
|
||||||
// var redoButton = $('#wmd-redo-button-realtime').removeClass("hide");
|
|
||||||
// $('#wmd-undo-button').addClass("hide");
|
|
||||||
// $('#wmd-redo-button').addClass("hide");
|
|
||||||
editor.uiManager.buttons.undo.execute = function() {
|
editor.uiManager.buttons.undo.execute = function() {
|
||||||
model.canUndo && model.undo();
|
model.canUndo && model.undo();
|
||||||
};
|
};
|
||||||
editor.uiManager.buttons.redo.execute = function() {
|
editor.uiManager.buttons.redo.execute = function() {
|
||||||
model.canRedo && model.redo();
|
model.canRedo && model.redo();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Add event handler for UndoRedoStateChanged events.
|
||||||
function setUndoRedoState() {
|
function setUndoRedoState() {
|
||||||
editor.uiManager.setButtonState(editor.uiManager.buttons.undo, model.canUndo);
|
editor.uiManager.setButtonState(editor.uiManager.buttons.undo, model.canUndo);
|
||||||
editor.uiManager.setButtonState(editor.uiManager.buttons.redo, model.canRedo);
|
editor.uiManager.setButtonState(editor.uiManager.buttons.redo, model.canRedo);
|
||||||
@ -326,14 +325,10 @@ define([
|
|||||||
realtimeDocument = undefined;
|
realtimeDocument = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set back original undo/redo actions
|
||||||
editor.uiManager.buttons.undo.execute = undoExecute;
|
editor.uiManager.buttons.undo.execute = undoExecute;
|
||||||
editor.uiManager.buttons.redo.execute = redoExecute;
|
editor.uiManager.buttons.redo.execute = redoExecute;
|
||||||
editor.uiManager.setUndoRedoButtonStates();
|
editor.uiManager.setUndoRedoButtonStates();
|
||||||
|
|
||||||
// $('#wmd-undo-button-realtime').off('click').addClass("hide");
|
|
||||||
// $('#wmd-redo-button-realtime').off('click').addClass("hide");
|
|
||||||
// $('#wmd-undo-button').removeClass("hide");
|
|
||||||
// $('#wmd-redo-button').removeClass("hide");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
core.onReady(function() {
|
core.onReady(function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user