Merge branch 'view-refactor' of stigma:platforma into zuber-view-refactor
[redakcja.git] / project / templates / toolbar_api / scriptlets.js
index 801e5d3..6f5258c 100644 (file)
@@ -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