Roo/bootstrap/form/HtmlEditorToolbar/Standard.js
authorAlan <alan@roojs.com>
Thu, 16 Feb 2023 07:40:43 +0000 (15:40 +0800)
committerAlan <alan@roojs.com>
Thu, 16 Feb 2023 07:40:43 +0000 (15:40 +0800)
Roo/bootstrap/form/HtmlEditorToolbar/Standard.js

index 6539ccb..d54e2fe 100644 (file)
@@ -142,11 +142,20 @@ Roo.extend(Roo.bootstrap.form.HtmlEditorToolbar.Standard, Roo.bootstrap.nav.Simp
         btn('align-right' , 'justifyright',true);
         btn('link', false, true, function(btn) {
             
-            var url = prompt(this.createLinkText, this.defaultLinkValue);
-            if(url && url != 'http:/'+'/'){
-                this.editorcore.relayCmd('createlink', url);
-            }
-        }),
+            Roo.bootstrap.MessageBox.prompt(
+                "Add / Edit Link URL",
+                "Enter the URL for the link",
+                function(pressed, url) {
+                    if (pressed != 'ok') {
+                        return;
+                    }
+                    
+                    if(url && url.match(/http(s):\/\/.+/)) {
+                        this.editorcore.relayCmd('createlink', url);
+                    }
+                }
+            );
+        });
         btn('list','insertunorderedlist',true);
         btn('list-ol','insertorderedlist',true);
 
@@ -246,6 +255,13 @@ Roo.extend(Roo.bootstrap.form.HtmlEditorToolbar.Standard, Roo.bootstrap.nav.Simp
         
         Roo.bootstrap.menu.Manager.hideAll();
         
+        
+        
+        Array.from(this.editorcore.doc.body.querySelectorAll('.roo-ed-selection')).forEach(function(e) {
+            e.classList.remove('roo-ed-selection');
+        });
+        
+        
         // handle delete button..
         if (hasToggle || (tn.length && tn == 'BODY')) {
             this.deleteBtn.hide();