6 self.singleClick = false;
8 let caret = this.element = $('<span id="caret"><textarea></textarea></span>');
10 // When user writes into caret, add it to the document.
11 $('textarea', caret).on('input', function() {
12 let v = $(this).val();
18 // On click on x-node element, set caret position.
19 self.view.on('click', '*[x-node]', function(e) {
20 if (e.redakcja_caret_inserted) return;
21 e.redakcja_caret_inserted = true;
23 if (self.singleClick) {
24 self.singleClick = false;
30 var selection = window.getSelection();
31 if (!selection.isCollapsed) return;
33 self.singleClick = true;
34 setTimeout(function() {
35 if (self.singleClick) {
36 self.element.insertBefore(
37 selection.anchorNode.splitText(
38 selection.anchorOffset
43 self.singleClick = false;
48 self.view.on('keydown', function(e) {
50 // Enter (split block)
54 // we are in <akap> (no going up)
55 // we are in <wyroznienie> (can go up)
56 // we are next to <wyroznienie> (can go inside)
94 // console.log('key', e.key, e.code);
100 return this.element.parent().length;
106 p = this.element.parent()[0]
107 this.element.detach();
113 $("textarea", self.element).focus();
117 this.element.parent()[0].normalize();
121 $(document.createTextNode(ch)).insertBefore(this.element);
126 let contents = this.element.parent().contents();
127 // Find the text before caret.
128 let textBefore = contents[contents.index(this.element) - 1];
130 // Should be text, but what if not?
131 textBefore.textContent = textBefore.textContent.substr(0, textBefore.textContent.length - 1);
137 let contents = this.element.parent().contents();
138 // Find the text after caret.
139 let textAfter = contents[contents.index(this.element) + 1];
140 textAfter.textContent = textAfter.textContent.substr(1);
146 edge: (i, l) => {return !i;},
147 enter: (l) => {return l - 1;},
148 splitTarget: (t) => {return t.splitText(t.length - 1);},
149 noSplitTarget: (t) => {return t.splitText(t.length);},
156 edge: (i, l) => {return i == l - 1;},
157 enter: (l) => {return 0;},
158 splitTarget: (t) => {return t.splitText(1);},
159 noSplitTarget: (t) => {return t;},
164 if (!this.attached) return;
167 let contents = this.element.parent().contents();
168 let index = contents.index(this.element);
169 let target, moved, oldparent;
171 let parent = this.element.parent()[0];
173 if (opts.edge(index, contents.length)) {
174 // We're at the end -- what to do?
177 if (parent.nodeName == 'EM') {
179 parent = parent.parentNode;
180 contents = $(parent).contents();
181 index = contents.index(oldparent);
186 target = contents[index];
189 while (target.nodeType == 1) {
190 // we've encountered a node.
193 if (target.nodeName == 'EM') {
196 contents = parent.contents();
197 index = opts.enter(contents.length);
198 target = contents[index];
200 // what if it has no elements?
203 index += opts.move; // again, what if end?
204 target = contents[index];
209 // what if editable but empty?
213 if (target.nodeType == 3) {
215 target = opts.splitTarget(target);
217 target = opts.noSplitTarget(target);
220 this.element.insertBefore(target);
228 /* Show theme to the user */
229 function selectTheme(themeId){
230 var selection = window.getSelection();
231 selection.removeAllRanges();
233 var range = document.createRange();
234 var s = $(".motyw[theme-class='" + themeId + "']")[0];
235 var e = $(".end[theme-class='" + themeId + "']")[0];
238 range.setStartAfter(s);
239 range.setEndBefore(e);
240 selection.addRange(range);
244 /* Verify insertion port for annotation or theme */
245 function verifyTagInsertPoint(node){
246 if (node.nodeType == 3) { // Text Node
247 node = node.parentNode;
250 if (node.nodeType != 1) {
255 var xtype = node.attr('x-node');
257 if (!xtype || (xtype.search(':') >= 0) ||
264 // don't allow themes inside annotations
265 if (node.closest('[x-node="pe"]').length > 0)
271 /* Convert HTML fragment to plaintext */
272 var ANNOT_FORBIDDEN = ['pt', 'pa', 'pr', 'pe', 'begin', 'end', 'motyw'];
274 function html2plainText(fragment){
277 $(fragment.childNodes).each(function(){
278 if (this.nodeType == 3) // textNode
279 text += this.nodeValue;
281 if (this.nodeType == 1 &&
282 $.inArray($(this).attr('x-node'), ANNOT_FORBIDDEN) == -1) {
283 text += html2plainText(this);
292 /* Insert annotation using current selection */
293 function addAnnotation(){
294 var selection = window.getSelection();
295 var n = selection.rangeCount;
298 window.alert("Nie zaznaczono żadnego obszaru");
302 // for now allow only 1 range
304 window.alert("Zaznacz jeden obszar");
308 // remember the selected range
309 var range = selection.getRangeAt(0);
311 if (!verifyTagInsertPoint(range.endContainer)) {
312 window.alert("Nie można wstawić w to miejsce przypisu.");
316 // BUG #273 - selected text can contain themes, which should be omitted from
318 var text = html2plainText(range.cloneContents());
319 var tag = $('<span></span>');
320 range.collapse(false);
321 range.insertNode(tag[0]);
324 xml: '<pe><slowo_obce>' + text + '</slowo_obce> --- </pe>',
325 success: function(text){
332 alert('Błąd przy dodawaniu przypisu:' + errors);
338 function addReference(){
339 var selection = window.getSelection();
340 var n = selection.rangeCount;
343 window.alert("Nie zaznaczono żadnego obszaru");
347 // for now allow only 1 range
349 window.alert("Zaznacz jeden obszar");
353 // remember the selected range
354 var range = selection.getRangeAt(0);
356 if (!verifyTagInsertPoint(range.endContainer)) {
357 window.alert("Nie można wstawić w to miejsce przypisu.");
361 var tag = $('<span></span>');
362 range.collapse(false);
363 range.insertNode(tag[0]);
366 xml: '<ref href=""/>',
367 success: function(text){
374 alert('Błąd przy dodawaniu referncji:' + errors);
382 /* Insert theme using current selection */
385 var selection = window.getSelection();
386 var n = selection.rangeCount;
389 window.alert("Nie zaznaczono żadnego obszaru");
393 // for now allow only 1 range
395 window.alert("Zaznacz jeden obszar.");
400 // remember the selected range
401 var range = selection.getRangeAt(0);
404 if ($(range.startContainer).is('.html-editarea') ||
405 $(range.endContainer).is('.html-editarea')) {
406 window.alert("Motywy można oznaczać tylko na tekście nie otwartym do edycji. \n Zamknij edytowany fragment i spróbuj ponownie.");
410 // verify if the start/end points make even sense -
411 // they must be inside a x-node (otherwise they will be discarded)
412 // and the x-node must be a main text
413 if (!verifyTagInsertPoint(range.startContainer)) {
414 window.alert("Motyw nie może się zaczynać w tym miejscu.");
418 if (!verifyTagInsertPoint(range.endContainer)) {
419 window.alert("Motyw nie może się kończyć w tym miejscu.");
423 var date = (new Date()).getTime();
424 var random = Math.floor(4000000000 * Math.random());
425 var id = ('' + date) + '-' + ('' + random);
427 var createPoint = function(container, offset) {
428 var offsetBetweenCommas = function(text, offset) {
429 if(text.length < 2 || offset < 1 || offset > text.length)
431 return text[offset-1] === ',' && text[offset] === ',';
433 var point = document.createRange();
434 offset = offsetBetweenCommas(container.textContent, offset) ? offset - 1 : offset;
435 point.setStart(container, offset);
439 var spoint = createPoint(range.startContainer, range.startOffset);
440 var epoint = createPoint(range.endContainer, range.endOffset);
442 var mtag, btag, etag, errors;
447 xml: '<end id="e' + id + '" />',
448 success: function(text){
449 etag = $('<span></span>');
450 epoint.insertNode(etag[0]);
451 etag.replaceWith(text);
453 xml: '<motyw id="m' + id + '"></motyw>',
454 success: function(text){
455 mtag = $('<span></span>');
456 spoint.insertNode(mtag[0]);
457 mtag.replaceWith(text);
459 xml: '<begin id="b' + id + '" />',
460 success: function(text){
461 btag = $('<span></span>');
462 spoint.insertNode(btag[0])
463 btag.replaceWith(text);
464 selection.removeAllRanges();
465 openForEdit($('.motyw[theme-class="' + id + '"]'));
474 function addSymbol(caret) {
478 editArea = $("textarea", caret.element)[0];
480 editArea = $('div.html-editarea textarea')[0];
484 var specialCharsContainer = $("<div id='specialCharsContainer'><a href='#' id='specialCharsClose'>Zamknij</a><table id='tableSpecialChars' style='width: 600px;'></table></div>");
486 var specialChars = [' ', 'Ą','ą','Ć','ć','Ę','ę','Ł','ł','Ń','ń','Ó','ó','Ś','ś','Ż','ż','Ź','ź','Á','á','À','à',
487 'Â','â','Ä','ä','Å','å','Ā','ā','Ă','ă','Ã','ã',
488 'Æ','æ','Ç','ç','Č','č','Ċ','ċ','Ď','ď','É','é','È','è',
489 'Ê','ê','Ë','ë','Ē','ē','Ě','ě','Ġ','ġ','Ħ','ħ','Í','í','Î','î',
490 'Ī','ī','Ĭ','ĭ','Ľ','ľ','Ñ','ñ','Ň','ň','Ó','ó','Ö','ö',
491 'Ô','ô','Ō','ō','Ǒ','ǒ','Œ','œ','Ø','ø','Ř','ř','Š',
492 'š','Ş','ş','Ť','ť','Ţ','ţ','Ű','ű','Ú','ú','Ù','ù',
493 'Ü','ü','Ů','ů','Ū','ū','Û','û','Ŭ','ŭ',
494 'Ý','ý','Ž','ž','ß','Ð','ð','Þ','þ','А','а','Б',
495 'б','В','в','Г','г','Д','д','Е','е','Ё','ё','Ж',
496 'ж','З','з','И','и','Й','й','К','к','Л','л','М',
497 'м','Н','н','О','о','П','п','Р','р','С','с',
498 'Т','т','У','у','Ф','ф','Х','х','Ц','ц','Ч',
499 'ч','Ш','ш','Щ','щ','Ъ','ъ','Ы','ы','Ь','ь','Э',
500 'э','Ю','ю','Я','я','ѓ','є','і','ї','ј','љ','њ',
501 'Ґ','ґ','Α','α','Β','β','Γ','γ','Δ','δ','Ε','ε',
502 'Ζ','ζ','Η','η','Θ','θ','Ι','ι','Κ','κ','Λ','λ','Μ',
503 'μ','Ν','ν','Ξ','ξ','Ο','ο','Π','π','Ρ','ρ','Σ','ς','σ',
504 'Τ','τ','Υ','υ','Φ','φ','Χ','χ','Ψ','ψ','Ω','ω','–',
505 '—','¡','¿','$','¢','£','€','©','®','°','¹','²','³',
506 '¼','½','¾','†','§','‰','•','←','↑','→','↓',
507 '„','”','„”','«','»','«»','»«','’','[',']','~','|','−','·',
508 '×','÷','≈','≠','±','≤','≥','∈'];
509 var tableContent = "<tr>";
511 for(var i in specialChars) {
512 if(i % 14 == 0 && i > 0) {
513 tableContent += "</tr><tr>";
515 tableContent += "<td><input type='button' class='specialBtn' value='"+specialChars[i]+"'/></td>";
518 tableContent += "</tr>";
519 $("body").append(specialCharsContainer);
522 // localStorage for recently used characters - reading
523 if (typeof(localStorage) != 'undefined') {
524 if (localStorage.getItem("recentSymbols")) {
525 var recent = localStorage.getItem("recentSymbols");
526 var recentArray = recent.split(";");
528 for(var i in recentArray.reverse()) {
529 recentRow += "<td><input type='button' class='specialBtn recentSymbol' value='"+recentArray[i]+"'/></td>";
531 recentRow = "<tr>" + recentRow + "</tr>";
534 $("#tableSpecialChars").append(recentRow);
535 $("#tableSpecialChars").append(tableContent);
539 $('.specialBtn').click(function(){
540 var insertVal = $(this).val();
542 // if we want to surround text with quotes
543 // not sure if just check if value has length == 2
546 caret.insertChar(insertVal);
549 if (insertVal.length == 2) {
550 var startTag = insertVal[0];
551 var endTag = insertVal[1];
552 var textAreaOpened = editArea;
554 if (document.selection) {
555 textAreaOpened.focus();
556 sel = document.selection.createRange();
557 sel.text = startTag + sel.text + endTag;
559 //MOZILLA/NETSCAPE support
560 else if (textAreaOpened.selectionStart || textAreaOpened.selectionStart == '0') {
561 var startPos = textAreaOpened.selectionStart;
562 var endPos = textAreaOpened.selectionEnd;
563 textAreaOpened.value = textAreaOpened.value.substring(0, startPos)
564 + startTag + textAreaOpened.value.substring(startPos, endPos) + endTag + textAreaOpened.value.substring(endPos, textAreaOpened.value.length);
567 insertAtCaret(editArea, insertVal);
571 // localStorage for recently used characters - saving
572 if (typeof(localStorage) != 'undefined') {
573 if (localStorage.getItem("recentSymbols")) {
574 var recent = localStorage.getItem("recentSymbols");
575 var recentArray = recent.split(";");
576 var valIndex = $.inArray(insertVal, recentArray);
579 // value not present in array yet
580 if(recentArray.length > 13){
582 recentArray.push(insertVal);
584 recentArray.push(insertVal);
587 // value already in the array
588 for(var i = valIndex; i < recentArray.length; i++){
589 recentArray[i] = recentArray[i+1];
591 recentArray[recentArray.length-1] = insertVal;
593 localStorage.setItem("recentSymbols", recentArray.join(";"));
595 localStorage.setItem("recentSymbols", insertVal);
598 $(specialCharsContainer).remove();
600 $('#specialCharsClose').click(function(){
601 $(specialCharsContainer).remove();
605 window.alert('Najedź na fragment tekstu, wybierz "Edytuj" i ustaw kursor na miejscu gdzie chcesz wstawić symbol.');
609 function insertAtCaret(txtarea,text) {
610 /* http://www.scottklarr.com/topic/425/how-to-insert-text-into-a-textarea-where-the-cursor-is/ */
611 var scrollPos = txtarea.scrollTop;
614 var br = ((txtarea.selectionStart || txtarea.selectionStart == '0') ? "ff" : (document.selection ? "ie" : false ) );
617 var range = document.selection.createRange();
618 range.moveStart ('character', -txtarea.value.length);
619 strPos = backStart = range.text.length;
620 } else if (br == "ff") {
621 strPos = txtarea.selectionStart;
622 backStart = txtarea.selectionEnd;
624 var front = (txtarea.value).substring(0,strPos);
625 var back = (txtarea.value).substring(backStart,txtarea.value.length);
626 txtarea.value=front+text+back;
627 strPos = strPos + text.length;
630 var range = document.selection.createRange();
631 range.moveStart ('character', -txtarea.value.length);
632 range.moveStart ('character', strPos);
633 range.moveEnd ('character', 0);
635 } else if (br == "ff") {
636 txtarea.selectionStart = strPos;
637 txtarea.selectionEnd = strPos;
640 txtarea.scrollTop = scrollPos;
643 /* open edition window for selected fragment */
644 function openForEdit($origin){
647 // annotations overlay their sub box - not their own box //
648 if ($origin.is(".annotation-inline-box")) {
649 $box = $("*[x-annotation-box]", $origin);
654 var x = $box[0].offsetLeft;
655 var y = $box[0].offsetTop;
657 var w = $box.outerWidth();
658 var h = $box.innerHeight();
660 if ($origin.is(".annotation-inline-box")) {
661 w = Math.max(w, 400);
663 if($('.htmlview div').offset().left + $('.htmlview div').width() > ($('.vsplitbar').offset().left - 480)){
664 x = -(Math.max($origin.offset().left, $origin.width()));
669 if ($origin.is('.reference-inline-box')) {
675 $('.htmlview div').offset().left + $('.htmlview div').width() - 400
679 // start edition on this node
680 var $overlay = $('<div class="html-editarea"><button class="accept-button">Zapisz</button><button class="delete-button">Usuń</button><button class="tytul-button akap-edit-button">tytuł dzieła</button><button class="wyroznienie-button akap-edit-button">wyróżnienie</button><button class="slowo-button akap-edit-button">słowo obce</button><button class="znak-button akap-edit-button">znak spec.</button><textarea></textarea></div>').css({
681 position: 'absolute',
686 }).appendTo($box[0].offsetParent || $box.parent()).show();
689 if ($origin.is('*[x-edit-no-format]')) {
690 $('.akap-edit-button').remove();
693 if ($origin.is('.motyw')) {
694 $.themes.autocomplete($('textarea', $overlay));
697 if ($origin.is('.motyw')){
698 $('.delete-button', $overlay).click(function(){
699 if (window.confirm("Czy jesteś pewien, że chcesz usunąć ten motyw?")) {
700 $('[theme-class="' + $origin.attr('theme-class') + '"]').remove();
702 $(document).unbind('click.blur-overlay');
707 else if($box.is('*[x-annotation-box]') || $origin.is('*[x-edit-attribute]')) {
708 $('.delete-button', $overlay).click(function(){
709 if (window.confirm("Czy jesteś pewien, że chcesz usunąć ten przypis?")) {
712 $(document).unbind('click.blur-overlay');
718 $('.delete-button', $overlay).html("Anuluj");
719 $('.delete-button', $overlay).click(function(){
720 if (window.confirm("Czy jesteś pewien, że chcesz anulować zmiany?")) {
722 $(document).unbind('click.blur-overlay');
729 var serializer = new XMLSerializer();
731 if($box.attr("x-edit-attribute")) {
732 source = $('<span x-pass-thru="true"/>');
733 source.text($box.attr("data-wlf-" + $box.attr("x-edit-attribute")));
742 success: function(text){
743 $('textarea', $overlay).val($.trim(text));
745 setTimeout(function(){
746 $('textarea', $overlay).elastic().focus();
749 function save(argument){
750 var nodeName = $box.attr('x-node') || 'pe';
751 var insertedText = $('textarea', $overlay).val();
753 if ($origin.is('.motyw')) {
754 insertedText = insertedText.replace(/,\s*$/, '');
757 if($box.attr("x-edit-attribute")) {
758 xml = '<' + nodeName + ' ' + $box.attr("x-edit-attribute") + '="' + insertedText + '"/>';
760 xml = '<' + nodeName + '>' + insertedText + '</' + nodeName + '>';
766 success: function(element){
767 if (nodeName == 'out-of-flow-text') {
768 $(element).children().insertAfter($origin);
771 else if ($box.attr('x-edit-attribute')) {
772 $(element).insertAfter($origin);
776 $origin.html($(element).html());
780 error: function(text){
781 alert('Błąd! ' + text);
785 var msg = $("<div class='saveNotify'><p>Pamiętaj, żeby zapisać swoje zmiany.</p></div>");
786 $("#base").prepend(msg);
787 $('#base .saveNotify').fadeOut(3000, function(){
792 $('.akap-edit-button', $overlay).click(function(){
793 var textAreaOpened = $('textarea', $overlay)[0];
796 var buttonName = this.innerHTML;
798 if(buttonName == "słowo obce") {
799 startTag = "<slowo_obce>";
800 endTag = "</slowo_obce>";
801 } else if (buttonName == "wyróżnienie") {
802 startTag = "<wyroznienie>";
803 endTag = "</wyroznienie>";
804 } else if (buttonName == "tytuł dzieła") {
805 startTag = "<tytul_dziela>";
806 endTag = "</tytul_dziela>";
807 } else if(buttonName == "znak spec."){
812 var myField = textAreaOpened;
815 if (document.selection) {
816 textAreaOpened.focus();
817 sel = document.selection.createRange();
818 sel.text = startTag + sel.text + endTag;
820 //MOZILLA/NETSCAPE support
821 else if (textAreaOpened.selectionStart || textAreaOpened.selectionStart == '0') {
822 var startPos = textAreaOpened.selectionStart;
823 var endPos = textAreaOpened.selectionEnd;
824 textAreaOpened.value = textAreaOpened.value.substring(0, startPos)
825 + startTag + textAreaOpened.value.substring(startPos, endPos) + endTag + textAreaOpened.value.substring(endPos, textAreaOpened.value.length);
829 $('.accept-button', $overlay).click(function(){
831 $(document).unbind('click.blur-overlay');
834 $(document).bind('click.blur-overlay', function(event){
835 if ($(event.target).closest('.html-editarea, #specialCharsContainer').length > 0) {
839 $(document).unbind('click.blur-overlay');
843 error: function(text){
844 alert('Błąd! ' + text);
850 function VisualPerspective(options){
853 var old_callback = options.callback;
855 options.callback = function(){
856 var element = $("#html-view");
857 var button = $('<button class="edit-button">Edytuj</button>');
859 if (!CurrentDocument.readonly) {
861 $('#html-view').bind('mousemove', function(event){
862 var editable = $(event.target).closest('*[x-editable]');
863 $('.active', element).not(editable).removeClass('active').children('.edit-button').remove();
865 if (!editable.hasClass('active')) {
866 editable.addClass('active').append(button);
868 if (editable.is('.annotation-inline-box')) {
869 $('*[x-annotation-box]', editable).css({
870 position: 'absolute',
871 left: event.clientX - editable.offset().left + 5,
872 top: event.clientY - editable.offset().top + 5
876 $('*[x-annotation-box]').hide();
880 $('#insert-reference-button').click(function(){
885 $('#insert-annotation-button').click(function(){
890 $('#insert-theme-button').click(function(){
896 $(".insert-inline-tag").click(function() {
897 perspective.insertInlineTag($(this).attr('data-tag'));
901 $(".insert-char").click(function() {
902 console.log('perspective', perspective);
903 addSymbol(caret=perspective.caret);
907 $(document).on('click', '.edit-button', function(event){
908 event.preventDefault();
909 openForEdit($(this).parent());
914 $(document).on('click', '.motyw', function(){
915 selectTheme($(this).attr('theme-class'));
918 old_callback.call(this);
921 $.wiki.Perspective.call(this, options);
924 VisualPerspective.prototype = new $.wiki.Perspective();
926 VisualPerspective.prototype.freezeState = function(){
930 VisualPerspective.prototype.onEnter = function(success, failure){
931 $.wiki.Perspective.prototype.onEnter.call(this);
934 message: 'Uaktualnianie widoku...'
937 function _finalize(callback){
946 base: this.doc.getBase(),
947 success: function(element){
949 var htmlView = $('#html-view');
950 htmlView.html(element);
952 perspective.caret = new Caret(htmlView);
956 htmlView.find('*[x-node]').dblclick(function(e) {
957 if($(e.target).is('textarea'))
959 var selection = window.getSelection();
960 selection.collapseToStart();
961 selection.modify('extend', 'forward', 'word');
966 error: function(text, source){
967 err = '<p class="error">Wystąpił błąd:</p><p>'+text+'</p>';
969 err += '<pre>'+source.replace(/&/g, '&').replace(/</g, '<')+'</pre>'
970 $('#html-view').html(err);
976 VisualPerspective.prototype.onExit = function(success, failure){
980 message: 'Zapisywanie widoku...'
983 function _finalize(callback){
989 if ($('#html-view .error').length > 0)
990 return _finalize(failure);
993 element: $('#html-view').get(0),
995 success: function(text){
996 self.doc.setText(text);
999 error: function(text){
1000 $('#source-editor').html('<p>Wystąpił błąd:</p><pre>' + text + '</pre>');
1006 VisualPerspective.prototype.insertInlineTag = function(tag) {
1007 this.caret.detach();
1009 let selection = window.getSelection();
1010 var n = selection.rangeCount;
1012 window.alert("Nie zaznaczono obszaru");
1015 let range = selection.getRangeAt(0);
1018 // Both ends are in the same x-node container.
1019 // TODO: That the container is a inline-text container.
1020 let node = range.startContainer;
1021 if (node.nodeType == node.TEXT_NODE) {
1022 node = node.parentNode;
1024 let endNode = range.endContainer;
1025 if (endNode.nodeType == endNode.TEXT_NODE) {
1026 endNode = endNode.parentNode;
1028 if (node != endNode) {
1029 window.alert("Zły obszar.");
1033 // We will construct a HTML element with the range selected.
1034 let div = $("<span x-pass-thru='true'>");
1036 contents = $(node).contents();
1037 let startChildIndex = node == range.startContainer ? 0 : contents.index(range.startContainer);
1038 let endChildIndex = contents.index(range.endContainer);
1040 current = range.startContainer;
1041 if (current.nodeType == current.TEXT_NODE) {
1042 current = current.splitText(range.startOffset);
1044 while (current != range.endContainer) {
1045 n = current.nextSibling;
1046 $(current).appendTo(div);
1049 if (current.nodeType == current.TEXT_NODE) {
1050 end = current.splitText(range.endOffset);
1052 $(current).appendTo(div);
1056 success: function(d) {
1058 xml: d = '<' + tag + '>' + d + '</' + tag + '>',
1059 success: function(html) {
1061 node.insertBefore($(html)[0], end);
1065 error: function(a, b) {
1073 $.wiki.VisualPerspective = VisualPerspective;