uppdated modules
This commit is contained in:
@@ -17,7 +17,7 @@ Drupal.linkit.registerDialogHelper('ckeditor', {
|
||||
*/
|
||||
afterInit : function () {
|
||||
var editor = Drupal.settings.linkit.currentInstance.editor;
|
||||
var element = CKEDITOR.plugins.link.getSelectedLink( editor );
|
||||
var element = CKEDITOR.plugins.link.getSelectedLink(editor);
|
||||
|
||||
// If we have selected a link element, lets populate the fields in the
|
||||
// modal with the values from that link element.
|
||||
|
||||
@@ -41,8 +41,20 @@
|
||||
|
||||
// Set the editor object.
|
||||
Drupal.settings.linkit.currentInstance.editor = editor;
|
||||
// Set profile.
|
||||
Drupal.settings.linkit.currentInstance.profile = Drupal.settings.linkit.fields[editor.name].profile;
|
||||
// Find the current input format of the field we're looking at.
|
||||
var format = '';
|
||||
if (Drupal.wysiwyg) { // If using the WYSIWYG module with CKEditor as the editor
|
||||
// Note that WYSIWYG prepends "profile" to the profile name, so we use .substring() to remove the "format".
|
||||
format = Drupal.wysiwyg.instances[editor.name].format.substring(6);
|
||||
}
|
||||
else if (Drupal.settings.ckeditor) { // If using the CKEditor module
|
||||
format = Drupal.settings.ckeditor.elements[editor.name];
|
||||
} else {
|
||||
alert(Drupal.t('Could not find the Linkit profile.'));
|
||||
return;
|
||||
}
|
||||
// Set profile based on the current text format of this field.
|
||||
Drupal.settings.linkit.currentInstance.profile = Drupal.settings.linkit.formats[format].profile;
|
||||
// Set the name of the source field.
|
||||
Drupal.settings.linkit.currentInstance.source = editor.name;
|
||||
// Set the source type.
|
||||
@@ -108,18 +120,22 @@
|
||||
|
||||
// Add a shortcut. Only CKeditor version 4 has this function.
|
||||
if (version >= 4) {
|
||||
editor.setKeystroke( CKEDITOR.CTRL + 76 /*L*/, 'linkit' );
|
||||
editor.setKeystroke(CKEDITOR.CTRL + 76 /*L*/, 'linkit');
|
||||
}
|
||||
|
||||
// Add event listener.
|
||||
editor.on( 'doubleclick', function( evt ) {
|
||||
editor.on('doubleclick', function(evt) {
|
||||
if (evt.data.dialog !== 'link') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete the default link dialog.
|
||||
delete evt.data.dialog;
|
||||
|
||||
var element = CKEDITOR.plugins.link.getSelectedLink( editor ) || evt.data.element;
|
||||
if ( !element.isReadOnly() ) {
|
||||
if ( element.is( 'a' ) ) {
|
||||
editor.getSelection().selectElement( element );
|
||||
var element = CKEDITOR.plugins.link.getSelectedLink(editor) || evt.data.element;
|
||||
if (!element.isReadOnly()) {
|
||||
if (element.is( 'a' )) {
|
||||
editor.getSelection().selectElement(element);
|
||||
if (version >= 4) {
|
||||
editor.commands.linkit.exec();
|
||||
}
|
||||
@@ -131,7 +147,7 @@
|
||||
});
|
||||
|
||||
// Register an extra fucntion, this will be used in the modal.
|
||||
editor._.linkitFnNum = CKEDITOR.tools.addFunction( insertLink, editor );
|
||||
editor._.linkitFnNum = CKEDITOR.tools.addFunction(insertLink, editor);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -150,7 +166,7 @@
|
||||
var range = selection.getRanges(1)[0];
|
||||
if (range.collapsed) {
|
||||
var content = (Drupal.settings.linkit.currentInstance.linkContent) ? Drupal.settings.linkit.currentInstance.linkContent : data.path;
|
||||
var text = new CKEDITOR.dom.text(content , editor.document );
|
||||
var text = new CKEDITOR.dom.text(content , editor.document);
|
||||
range.insertNode(text);
|
||||
range.selectNodeContents(text);
|
||||
}
|
||||
|
||||
@@ -17,8 +17,18 @@
|
||||
|
||||
// Set the editor object.
|
||||
Drupal.settings.linkit.currentInstance.editor = editor;
|
||||
// Set profile.
|
||||
Drupal.settings.linkit.currentInstance.profile = Drupal.settings.linkit.fields[editor.id].profile;
|
||||
|
||||
// Find the current input format of the field we're looking at. Note that we get it in the form
|
||||
// "format<formatname" instead of just "<formatname>" so we use .substring() to remove the "format".
|
||||
if (Drupal.wysiwyg && Drupal.wysiwyg.instances[editor.id].format) {
|
||||
var format = Drupal.wysiwyg.instances[editor.id].format.substring(6);
|
||||
} else {
|
||||
alert(Drupal.t('Could not find the Linkit profile.'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Set profile based on the current text format of this field.
|
||||
Drupal.settings.linkit.currentInstance.profile = Drupal.settings.linkit.formats[format].profile;
|
||||
|
||||
// Set the name of the source field..
|
||||
Drupal.settings.linkit.currentInstance.source = editor.id;
|
||||
|
||||
Reference in New Issue
Block a user