I'll do the custom Mark function, this opens a dialog wich allows you to mark the word you selected for later indexing and add a description.
This is the one with the least amount of javascript.
I still have to replace the handwritten html with "
var element = editor.GetFrame().contentDocument.createElement("mark");
" . But I first want the right functionality.
- var editor;
- function RichTextEditor_OnLoad(rteeditor) {
- editor = rteeditor;
- editor.AttachEvent("ExecUICommand", CaptureSaveEvent);
- }
- function CaptureSaveEvent(rteeditor, info) {
- if (!rteeditor) return;
- if (!info || !info.Arguments || !info.Arguments[1]) return;
-
- if (info.Arguments[1] == "DoMark") {
-
-
- var oldvalue = editor.GetRangePreviewHTML();
- editor.ShowXmlDialog("/richtexteditor/dialogs/mark.xml", {
- value: oldvalue,
- confirm: function (markvalue) {
- if (!!markvalue && markvalue.trim() != "") {
- var newvalue = "<mark data-value=\"" + markvalue + "\">" + oldvalue + "</mark>";
- var insert = editor.InsertHTML(newvalue, true);
- insert[0].Ox13.focus(0);
- insert[0].Ox13.selectionStart = 0;
- insert[0].Ox13.selectionEnd = 0;
- editor.ExecCommand("CleanCode");
- }
- }
- });
- }
- }