X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/a52b687ba6a6e2647f0e1f173b1a85cbeaa2d326..ed513d6c11381d01e5c271fd0d12f49f5ae7c8f5:/project/templates/toolbar_api/scriptlets.js?ds=inline diff --git a/project/templates/toolbar_api/scriptlets.js b/project/templates/toolbar_api/scriptlets.js index 801e5d3e..6f5258c9 100644 --- a/project/templates/toolbar_api/scriptlets.js +++ b/project/templates/toolbar_api/scriptlets.js @@ -8,8 +8,23 @@ function ScriptletCenter() { {% endfor %} _none: null - }; + }; } +ScriptletCenter.prototype.XMLEditorSelectedText = function(panel) { + return panel.contentView.editor.selection(); +} + +ScriptletCenter.prototype.XMLEditorReplaceSelectedText = function(panel, replacement) +{ + panel.contentView.editor.replaceSelection(replacement); + /* TODO: fire the change event */ +} + +ScriptletCenter.prototype.XMLEditorMoveCursorForward = function(panel, n) { + var pos = panel.contentView.editor.cursorPosition(); + panel.contentView.editor.selectLines(pos.line, pos.character + n); +} + scriptletCenter = new ScriptletCenter(); \ No newline at end of file