39 Zeilen
853 B
JavaScript
Ausführbare Datei
39 Zeilen
853 B
JavaScript
Ausführbare Datei
/**
|
|
* plugin.js
|
|
*
|
|
* Copyright, Moxiecode Systems AB
|
|
* Released under LGPL License.
|
|
*
|
|
* License: http://www.tinymce.com/license
|
|
* Contributing: http://www.tinymce.com/contributing
|
|
*/
|
|
|
|
/*global tinymce:true */
|
|
|
|
tinymce.PluginManager.add('anchor', function(editor) {
|
|
function showDialog() {
|
|
editor.windowManager.open({
|
|
title: 'Anchor',
|
|
body: {type: 'textbox', name: 'name', size: 40, label: 'Name', value: editor.selection.getNode().id},
|
|
onsubmit: function(e) {
|
|
editor.execCommand('mceInsertContent', false, editor.dom.createHTML('a', {
|
|
id: e.data.name
|
|
}));
|
|
}
|
|
});
|
|
}
|
|
|
|
editor.addButton('anchor', {
|
|
icon: 'anchor',
|
|
tooltip: 'Anchor',
|
|
onclick: showDialog,
|
|
stateSelector: 'a:not([href])'
|
|
});
|
|
|
|
editor.addMenuItem('anchor', {
|
|
icon: 'anchor',
|
|
text: 'Anchor',
|
|
context: 'insert',
|
|
onclick: showDialog
|
|
});
|
|
}); |