X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/006c13d480258ab24c03abc8fef60aad8aa66e71..d71968e15d1f77dc04908f30237e37163d54efde:/project/templates/toolbar_api/scriptlets.js?ds=sidebyside 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