-/* global adminpage, wpActiveEditor, quicktagsL10n, wpLink, fullscreen, prompt */
+/* global adminpage, wpActiveEditor, quicktagsL10n, wpLink, prompt */
/*
* Quicktags
*
tb = document.createElement('div');
tb.id = toolbar_id;
tb.className = 'quicktags-toolbar';
+ tb.onclick = function() {
+ window.wpActiveEditor = id;
+ };
canvas.parentNode.insertBefore(tb, canvas);
t.toolbar = tb;
};
qt.Button.prototype.html = function(idPrefix) {
var access = this.access ? ' accesskey="' + this.access + '"' : '';
- return '<input type="button" id="' + idPrefix + this.id + '"' + access + ' class="ed_button" title="' + this.title + '" value="' + this.display + '" />';
+ if ( this.id === 'fullscreen' ) {
+ return '<button type="button" id="' + idPrefix + this.id + '"' + access + ' class="ed_button qt-fullscreen" title="' + this.title + '"></button>';
+ }
+ return '<input type="button" id="' + idPrefix + this.id + '"' + access + ' class="ed_button button button-small" title="' + this.title + '" value="' + this.display + '" />';
};
qt.Button.prototype.callback = function(){};
qt.LinkButton.prototype.callback = function(e, c, ed, defaultValue) {
var URL, t = this;
- if ( typeof(wpLink) !== 'undefined' ) {
- wpLink.open();
+ if ( typeof wpLink !== 'undefined' ) {
+ wpLink.open( ed.id );
return;
}
};
qt.FullscreenButton.prototype = new qt.Button();
qt.FullscreenButton.prototype.callback = function(e, c) {
- if ( !c.id || typeof(fullscreen) === 'undefined' ) {
+ if ( ! c.id || typeof wp === 'undefined' || ! wp.editor || ! wp.editor.fullscreen ) {
return;
}
- fullscreen.on();
+ wp.editor.fullscreen.on();
};
qt.TextDirectionButton = function() {
edButtons[90] = new qt.TagButton('ol','ol','<ol>\n','</ol>\n\n','o'),
edButtons[100] = new qt.TagButton('li','li','\t<li>','</li>\n','l'),
edButtons[110] = new qt.TagButton('code','code','<code>','</code>','c'),
- edButtons[120] = new qt.TagButton('more','more','<!--more-->','','t'),
+ edButtons[120] = new qt.TagButton('more','more','<!--more-->\n\n','','t'),
edButtons[140] = new qt.CloseButton();
})();