Ver código fonte

FIX #25113 #25173

Laurent Destailleur 2 anos atrás
pai
commit
71a71c73e7

+ 20 - 0
htdocs/theme/eldy/ckeditor/config.js

@@ -104,3 +104,23 @@ CKEDITOR.editorConfig = function( config )
 	 	['Source']
 	];
 };
+
+
+/* Code to make links into CKEditor, in readonly, mode clickable */
+CKEDITOR.on('instanceReady', function(event) {
+    var editor = event.editor;
+	if (editor.readOnly) {
+	  var editable = editor.editable();
+	  editable.attachListener(editable, 'click', function(evt) {
+	    console.log("We click on a link in CKEditor in readonly mode");
+	    var target = evt.data.getTarget();
+	    var anchor = target.getAscendant('a', true);
+	    if (anchor) {
+	      var href = anchor.getAttribute('href');
+	      if (href) {
+	        window.open(href, '_blank'); // Open link in a new tab/window
+	      }
+	    }
+	  });
+	}
+});

+ 21 - 0
htdocs/theme/md/ckeditor/config.js

@@ -104,3 +104,24 @@ CKEDITOR.editorConfig = function( config )
 	 	['Source']
 	];
 };
+
+
+/* Code to make links into CKEditor, in readonly, mode clickable */
+CKEDITOR.on('instanceReady', function(event) {
+    var editor = event.editor;
+	if (editor.readOnly) {
+	  var editable = editor.editable();
+	  editable.attachListener(editable, 'click', function(evt) {
+	    console.log("We click on a link in CKEditor in readonly mode");
+	    var target = evt.data.getTarget();
+	    var anchor = target.getAscendant('a', true);
+	    if (anchor) {
+	      var href = anchor.getAttribute('href');
+	      if (href) {
+	        window.open(href, '_blank'); // Open link in a new tab/window
+	      }
+	    }
+	  });
+	}
+});
+