Replace two composer IPC calls for indenting with a single one.
* src/client/composer/composer-web-view.vala (ClientWebView): Replace ::undo_blockquote_style with ::indent_line. * src/client/composer/composer-widget.vala (ComposerWidget::on_indent): Call new ::indent_line method, rather than doing a execCommand and a second JS thunking call to fix the markup. * ui/composer-web-view.js: Also replace ::undoBlockquoteStyle with new ::indentLine method. Add unit test.
This commit is contained in:
parent
e06a73ebd6
commit
e22ece508c
4 changed files with 37 additions and 19 deletions
|
|
@ -157,6 +157,17 @@ ComposerPageState.prototype = {
|
|||
}
|
||||
}
|
||||
},
|
||||
indentLine: function() {
|
||||
document.execCommand("indent", false, null);
|
||||
let nodeList = document.querySelectorAll(
|
||||
"blockquote[style=\"margin: 0 0 0 40px; border: none; padding: 0px;\"]"
|
||||
);
|
||||
for (let i = 0; i < nodeList.length; ++i) {
|
||||
let element = nodeList.item(i);
|
||||
element.removeAttribute("style");
|
||||
element.setAttribute("type", "cite");
|
||||
}
|
||||
},
|
||||
updateSignature: function(signature) {
|
||||
// XXX need mark the sig somehow so we can find it, select
|
||||
// it and replace it using execCommand
|
||||
|
|
@ -278,16 +289,6 @@ ComposerPageState.prototype = {
|
|||
);
|
||||
}
|
||||
},
|
||||
undoBlockquoteStyle: function() {
|
||||
let nodeList = document.querySelectorAll(
|
||||
"blockquote[style=\"margin: 0 0 0 40px; border: none; padding: 0px;\"]"
|
||||
);
|
||||
for (let i = 0; i < nodeList.length; ++i) {
|
||||
let element = nodeList.item(i);
|
||||
element.removeAttribute("style");
|
||||
element.setAttribute("type", "cite");
|
||||
}
|
||||
},
|
||||
documentModified: function(element) {
|
||||
window.webkit.messageHandlers.documentModified.postMessage(null);
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue