diff --git a/bin/Editor.js b/bin/Editor.js index 4e2de980caedfb8925e5858b8e3abeabda0e3881..470d74465532145488806b4a7b31df4823631cdc 100644 --- a/bin/Editor.js +++ b/bin/Editor.js @@ -829,26 +829,7 @@ define('package/quiqqer/ckeditor4/bin/Editor', [ oldOnShow = dialogDefinition.onShow; - // Turn "relation" text-input to a select-input (quiqqer/ckeditor4#28) - var RelationInput = dialogDefinition.getContents("advanced").get('advRel'); - - RelationInput.type = 'select'; - RelationInput.items = [ - ['alternate'], - ['author'], - ['bookmark'], - ['external'], - ['help'], - ['license'], - ['next'], - ['nofollow'], - ['noreferrer'], - ['noopener'], - ['prev'], - ['search'], - ['tag'] - ]; - + self.$turnLinkRelInputToSelect(dialogDefinition); // Get a reference to the "Link Info" tab. dialogDefinition.onShow = function () { @@ -1034,6 +1015,51 @@ define('package/quiqqer/ckeditor4/bin/Editor', [ }; return ev; + }, + + /** + * Turns the "relation" text-input to a select-input. + * Returns as a boolean if the operation was successful. + * + * @see "quiqqer/ckeditor4#28" + * + * @param DialogDefinition + * + * @return boolean + */ + $turnLinkRelInputToSelect: function(DialogDefinition) { + var AdvancedTab = DialogDefinition.getContents("advanced"); + + if (!AdvancedTab) { + return false; + } + + var RelationInput = AdvancedTab.get('advRel'); + + if (!RelationInput) { + return false; + } + + if (RelationInput) { + RelationInput.type = 'select'; + RelationInput.items = [ + ['alternate'], + ['author'], + ['bookmark'], + ['external'], + ['help'], + ['license'], + ['next'], + ['nofollow'], + ['noreferrer'], + ['noopener'], + ['prev'], + ['search'], + ['tag'] + ]; + } + + return true; } });