Explorar o código

#4180 - Editor: mentions become broken or removed after editing

roman.lesnikov@gmail.com %!s(int64=3) %!d(string=hai) anos
pai
achega
daa25fc8f7
Modificáronse 2 ficheiros con 5 adicións e 2 borrados
  1. 3 0
      inc/js/editor.quill.js
  2. 2 2
      modules/boonex/editor/js/editor.js

+ 3 - 0
inc/js/editor.quill.js

@@ -144,6 +144,9 @@ function bx_editor_init(oEditor, oParams){
                 if (node.hasAttribute('title')) {
                     format.title = node.getAttribute('title');
                 }
+                else{
+                     format.title = node.innerText.replace(node.getAttribute('dchar'), '');
+                }
                 if (node.hasAttribute('dchar')) {
                     format.dchar = node.getAttribute('dchar');
                 }

+ 2 - 2
modules/boonex/editor/js/editor.js

@@ -129,7 +129,7 @@ function bx_ex_editor_init(oEditor, oParams)
             {
                 selectTemplate: function(item) {
                     if (this.range.isContentEditable(this.current.element)) {
-                        return ('<a class="bx-mention-link" dchar="@" data-profile-id="' + item.original.value + '" href="' + item.original.url + '">@' + item.original.label + '</a>');
+                        return ('<a class="bx-mention-link" title="' + item.original.label + '" dchar="@" data-profile-id="' + item.original.value + '" href="' + item.original.url + '">@' + item.original.label + '</a>');
                     }
                     return "@" + item.original.value;
                 },
@@ -145,7 +145,7 @@ function bx_ex_editor_init(oEditor, oParams)
                 trigger: "#",
                 selectTemplate: function(item) {
                     if (this.range.isContentEditable(this.current.element)) {
-                        return ('<a class="bx-mention-link" dchar="#" data-profile-id="' + item.original.value + '" href="' + item.original.url + '">#' + item.original.label + '</a>');
+                        return ('<a class="bx-mention-link" title="' + item.original.label + '" dchar="#" data-profile-id="' + item.original.value + '" href="' + item.original.url + '">#' + item.original.label + '</a>');
                     }
                     return "#" + item.original.value;
                 },