forked from Wavyzz/dolibarr
@@ -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
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user