update
This commit is contained in:
bovenliggende
923478454e
commit
a1f8d715ed
@ -1,57 +0,0 @@
|
||||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.AdvancedHRPlugin', {
|
||||
init : function(ed, url) {
|
||||
// Register commands
|
||||
ed.addCommand('mceAdvancedHr', function() {
|
||||
ed.windowManager.open({
|
||||
file : url + '/rule.htm',
|
||||
width : 250 + parseInt(ed.getLang('advhr.delta_width', 0)),
|
||||
height : 160 + parseInt(ed.getLang('advhr.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('advhr', {
|
||||
title : 'advhr.advhr_desc',
|
||||
cmd : 'mceAdvancedHr'
|
||||
});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setActive('advhr', n.nodeName == 'HR');
|
||||
});
|
||||
|
||||
ed.onClick.add(function(ed, e) {
|
||||
e = e.target;
|
||||
|
||||
if (e.nodeName === 'HR')
|
||||
ed.selection.select(e);
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Advanced HR',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('advhr', tinymce.plugins.AdvancedHRPlugin);
|
||||
})();
|
@ -1,8 +0,0 @@
|
||||
.mceLinkList, .mceAnchorList, #targetlist {width:280px;}
|
||||
.mceActionPanel {margin-top:7px;}
|
||||
.panel_wrapper div.current {height:320px;}
|
||||
#classlist, #title, #href {width:280px;}
|
||||
#popupurl, #popupname {width:200px;}
|
||||
#popupwidth, #popupheight, #popupleft, #popuptop {width:30px;vertical-align:middle;text-align:center;}
|
||||
#id, #style, #classes, #target, #dir, #hreflang, #lang, #charset, #type, #rel, #rev, #tabindex, #accesskey {width:200px;}
|
||||
#events_panel input {width:200px;}
|
Binair bestand niet weergegeven.
Voor Breedte: | Hoogte: | Grootte: 329 B |
Binair bestand niet weergegeven.
Voor Breedte: | Hoogte: | Grootte: 340 B |
Binair bestand niet weergegeven.
Voor Breedte: | Hoogte: | Grootte: 321 B |
Binair bestand niet weergegeven.
Voor Breedte: | Hoogte: | Grootte: 344 B |
@ -1,84 +0,0 @@
|
||||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
// Load plugin specific language pack
|
||||
tinymce.PluginManager.requireLangPack('example');
|
||||
|
||||
tinymce.create('tinymce.plugins.ExamplePlugin', {
|
||||
/**
|
||||
* Initializes the plugin, this will be executed after the plugin has been created.
|
||||
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
||||
* of the editor instance to intercept that event.
|
||||
*
|
||||
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
||||
* @param {string} url Absolute URL to where the plugin is located.
|
||||
*/
|
||||
init : function(ed, url) {
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
||||
ed.addCommand('mceExample', function() {
|
||||
ed.windowManager.open({
|
||||
file : url + '/dialog.htm',
|
||||
width : 320 + parseInt(ed.getLang('example.delta_width', 0)),
|
||||
height : 120 + parseInt(ed.getLang('example.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url, // Plugin absolute URL
|
||||
some_custom_arg : 'custom arg' // Custom argument
|
||||
});
|
||||
});
|
||||
|
||||
// Register example button
|
||||
ed.addButton('example', {
|
||||
title : 'example.desc',
|
||||
cmd : 'mceExample',
|
||||
image : url + '/img/example.gif'
|
||||
});
|
||||
|
||||
// Add a node change handler, selects the button in the UI when a image is selected
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setActive('example', n.nodeName == 'IMG');
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates control instances based in the incomming name. This method is normally not
|
||||
* needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
|
||||
* but you sometimes need to create more complex controls like listboxes, split buttons etc then this
|
||||
* method can be used to create those.
|
||||
*
|
||||
* @param {String} n Name of the control to create.
|
||||
* @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
|
||||
* @return {tinymce.ui.Control} New control instance or null if no control was created.
|
||||
*/
|
||||
createControl : function(n, cm) {
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns information about the plugin as a name/value array.
|
||||
* The current keys are longname, author, authorurl, infourl and version.
|
||||
*
|
||||
* @return {Object} Name/value array containing information about the plugin.
|
||||
*/
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Example plugin',
|
||||
author : 'Some author',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example',
|
||||
version : "1.0"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('example', tinymce.plugins.ExamplePlugin);
|
||||
})();
|
@ -1,19 +0,0 @@
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var ExampleDialog = {
|
||||
init : function() {
|
||||
var f = document.forms[0];
|
||||
|
||||
// Get the selected contents as text and place it in the input
|
||||
f.someval.value = tinyMCEPopup.editor.selection.getContent({format : 'text'});
|
||||
f.somearg.value = tinyMCEPopup.getWindowArg('some_custom_arg');
|
||||
},
|
||||
|
||||
insert : function() {
|
||||
// Insert the contents from the input into the document
|
||||
tinyMCEPopup.editor.execCommand('mceInsertContent', false, document.forms[0].someval.value);
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCEPopup.onInit.add(ExampleDialog.init, ExampleDialog);
|
@ -1,159 +0,0 @@
|
||||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var DOM = tinymce.DOM;
|
||||
|
||||
tinymce.create('tinymce.plugins.FullScreenPlugin', {
|
||||
init : function(ed, url) {
|
||||
var t = this, s = {}, vp, posCss;
|
||||
|
||||
t.editor = ed;
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mceFullScreen', function() {
|
||||
var win, de = DOM.doc.documentElement;
|
||||
|
||||
if (ed.getParam('fullscreen_is_enabled')) {
|
||||
if (ed.getParam('fullscreen_new_window'))
|
||||
closeFullscreen(); // Call to close in new window
|
||||
else {
|
||||
DOM.win.setTimeout(function() {
|
||||
tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc);
|
||||
tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent());
|
||||
tinyMCE.remove(ed);
|
||||
DOM.remove('mce_fullscreen_container');
|
||||
de.style.overflow = ed.getParam('fullscreen_html_overflow');
|
||||
DOM.setStyle(DOM.doc.body, 'overflow', ed.getParam('fullscreen_overflow'));
|
||||
DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly'));
|
||||
tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings
|
||||
}, 10);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ed.getParam('fullscreen_new_window')) {
|
||||
win = DOM.win.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight);
|
||||
try {
|
||||
win.resizeTo(screen.availWidth, screen.availHeight);
|
||||
} catch (e) {
|
||||
// Ignore
|
||||
}
|
||||
} else {
|
||||
tinyMCE.oldSettings = tinyMCE.settings; // Store old settings
|
||||
s.fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto';
|
||||
s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1);
|
||||
vp = DOM.getViewPort();
|
||||
s.fullscreen_scrollx = vp.x;
|
||||
s.fullscreen_scrolly = vp.y;
|
||||
|
||||
// Fixes an Opera bug where the scrollbars doesn't reappear
|
||||
if (tinymce.isOpera && s.fullscreen_overflow == 'visible')
|
||||
s.fullscreen_overflow = 'auto';
|
||||
|
||||
// Fixes an IE bug where horizontal scrollbars would appear
|
||||
if (tinymce.isIE && s.fullscreen_overflow == 'scroll')
|
||||
s.fullscreen_overflow = 'auto';
|
||||
|
||||
// Fixes an IE bug where the scrollbars doesn't reappear
|
||||
if (tinymce.isIE && (s.fullscreen_html_overflow == 'visible' || s.fullscreen_html_overflow == 'scroll'))
|
||||
s.fullscreen_html_overflow = 'auto';
|
||||
|
||||
if (s.fullscreen_overflow == '0px')
|
||||
s.fullscreen_overflow = '';
|
||||
|
||||
DOM.setStyle(DOM.doc.body, 'overflow', 'hidden');
|
||||
de.style.overflow = 'hidden'; //Fix for IE6/7
|
||||
vp = DOM.getViewPort();
|
||||
DOM.win.scrollTo(0, 0);
|
||||
|
||||
if (tinymce.isIE)
|
||||
vp.h -= 1;
|
||||
|
||||
// Use fixed position if it exists
|
||||
if (tinymce.isIE6 || document.compatMode == 'BackCompat')
|
||||
posCss = 'absolute;top:' + vp.y;
|
||||
else
|
||||
posCss = 'fixed;top:0';
|
||||
|
||||
n = DOM.add(DOM.doc.body, 'div', {
|
||||
id : 'mce_fullscreen_container',
|
||||
style : 'position:' + posCss + ';left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'});
|
||||
DOM.add(n, 'div', {id : 'mce_fullscreen'});
|
||||
|
||||
tinymce.each(ed.settings, function(v, n) {
|
||||
s[n] = v;
|
||||
});
|
||||
|
||||
s.id = 'mce_fullscreen';
|
||||
s.width = n.clientWidth;
|
||||
s.height = n.clientHeight - 15;
|
||||
s.fullscreen_is_enabled = true;
|
||||
s.fullscreen_editor_id = ed.id;
|
||||
s.theme_advanced_resizing = false;
|
||||
s.save_onsavecallback = function() {
|
||||
ed.setContent(tinyMCE.get(s.id).getContent());
|
||||
ed.execCommand('mceSave');
|
||||
};
|
||||
|
||||
tinymce.each(ed.getParam('fullscreen_settings'), function(v, k) {
|
||||
s[k] = v;
|
||||
});
|
||||
|
||||
if (s.theme_advanced_toolbar_location === 'external')
|
||||
s.theme_advanced_toolbar_location = 'top';
|
||||
|
||||
t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s);
|
||||
t.fullscreenEditor.onInit.add(function() {
|
||||
t.fullscreenEditor.setContent(ed.getContent());
|
||||
t.fullscreenEditor.focus();
|
||||
});
|
||||
|
||||
t.fullscreenEditor.render();
|
||||
|
||||
t.fullscreenElement = new tinymce.dom.Element('mce_fullscreen_container');
|
||||
t.fullscreenElement.update();
|
||||
//document.body.overflow = 'hidden';
|
||||
|
||||
t.resizeFunc = tinymce.dom.Event.add(DOM.win, 'resize', function() {
|
||||
var vp = tinymce.DOM.getViewPort(), fed = t.fullscreenEditor, outerSize, innerSize;
|
||||
|
||||
// Get outer/inner size to get a delta size that can be used to calc the new iframe size
|
||||
outerSize = fed.dom.getSize(fed.getContainer().getElementsByTagName('table')[0]);
|
||||
innerSize = fed.dom.getSize(fed.getContainer().getElementsByTagName('iframe')[0]);
|
||||
|
||||
fed.theme.resizeTo(vp.w - outerSize.w + innerSize.w, vp.h - outerSize.h + innerSize.h);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('fullscreen', {title : 'fullscreen.desc', cmd : 'mceFullScreen'});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm) {
|
||||
cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled'));
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Fullscreen',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('fullscreen', tinymce.plugins.FullScreenPlugin);
|
||||
})();
|
Binair bestand niet weergegeven.
Voor Breedte: | Hoogte: | Grootte: 909 B |
@ -1,262 +0,0 @@
|
||||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
function findParentLayer(node) {
|
||||
do {
|
||||
if (node.className && node.className.indexOf('mceItemLayer') != -1) {
|
||||
return node;
|
||||
}
|
||||
} while (node = node.parentNode);
|
||||
};
|
||||
|
||||
tinymce.create('tinymce.plugins.Layer', {
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.editor = ed;
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mceInsertLayer', t._insertLayer, t);
|
||||
|
||||
ed.addCommand('mceMoveForward', function() {
|
||||
t._move(1);
|
||||
});
|
||||
|
||||
ed.addCommand('mceMoveBackward', function() {
|
||||
t._move(-1);
|
||||
});
|
||||
|
||||
ed.addCommand('mceMakeAbsolute', function() {
|
||||
t._toggleAbsolute();
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('moveforward', {title : 'layer.forward_desc', cmd : 'mceMoveForward'});
|
||||
ed.addButton('movebackward', {title : 'layer.backward_desc', cmd : 'mceMoveBackward'});
|
||||
ed.addButton('absolute', {title : 'layer.absolute_desc', cmd : 'mceMakeAbsolute'});
|
||||
ed.addButton('insertlayer', {title : 'layer.insertlayer_desc', cmd : 'mceInsertLayer'});
|
||||
|
||||
ed.onInit.add(function() {
|
||||
var dom = ed.dom;
|
||||
|
||||
if (tinymce.isIE)
|
||||
ed.getDoc().execCommand('2D-Position', false, true);
|
||||
});
|
||||
|
||||
// Remove serialized styles when selecting a layer since it might be changed by a drag operation
|
||||
ed.onMouseUp.add(function(ed, e) {
|
||||
var layer = findParentLayer(e.target);
|
||||
|
||||
if (layer) {
|
||||
ed.dom.setAttrib(layer, 'data-mce-style', '');
|
||||
}
|
||||
});
|
||||
|
||||
// Fixes edit focus issues with layers on Gecko
|
||||
// This will enable designMode while inside a layer and disable it when outside
|
||||
ed.onMouseDown.add(function(ed, e) {
|
||||
var node = e.target, doc = ed.getDoc(), parent;
|
||||
|
||||
if (tinymce.isGecko) {
|
||||
if (findParentLayer(node)) {
|
||||
if (doc.designMode !== 'on') {
|
||||
doc.designMode = 'on';
|
||||
|
||||
// Repaint caret
|
||||
node = doc.body;
|
||||
parent = node.parentNode;
|
||||
parent.removeChild(node);
|
||||
parent.appendChild(node);
|
||||
}
|
||||
} else if (doc.designMode == 'on') {
|
||||
doc.designMode = 'off';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ed.onNodeChange.add(t._nodeChange, t);
|
||||
ed.onVisualAid.add(t._visualAid, t);
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Layer',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
// Private methods
|
||||
|
||||
_nodeChange : function(ed, cm, n) {
|
||||
var le, p;
|
||||
|
||||
le = this._getParentLayer(n);
|
||||
p = ed.dom.getParent(n, 'DIV,P,IMG');
|
||||
|
||||
if (!p) {
|
||||
cm.setDisabled('absolute', 1);
|
||||
cm.setDisabled('moveforward', 1);
|
||||
cm.setDisabled('movebackward', 1);
|
||||
} else {
|
||||
cm.setDisabled('absolute', 0);
|
||||
cm.setDisabled('moveforward', !le);
|
||||
cm.setDisabled('movebackward', !le);
|
||||
cm.setActive('absolute', le && le.style.position.toLowerCase() == "absolute");
|
||||
}
|
||||
},
|
||||
|
||||
// Private methods
|
||||
|
||||
_visualAid : function(ed, e, s) {
|
||||
var dom = ed.dom;
|
||||
|
||||
tinymce.each(dom.select('div,p', e), function(e) {
|
||||
if (/^(absolute|relative|fixed)$/i.test(e.style.position)) {
|
||||
if (s)
|
||||
dom.addClass(e, 'mceItemVisualAid');
|
||||
else
|
||||
dom.removeClass(e, 'mceItemVisualAid');
|
||||
|
||||
dom.addClass(e, 'mceItemLayer');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_move : function(d) {
|
||||
var ed = this.editor, i, z = [], le = this._getParentLayer(ed.selection.getNode()), ci = -1, fi = -1, nl;
|
||||
|
||||
nl = [];
|
||||
tinymce.walk(ed.getBody(), function(n) {
|
||||
if (n.nodeType == 1 && /^(absolute|relative|static)$/i.test(n.style.position))
|
||||
nl.push(n);
|
||||
}, 'childNodes');
|
||||
|
||||
// Find z-indexes
|
||||
for (i=0; i<nl.length; i++) {
|
||||
z[i] = nl[i].style.zIndex ? parseInt(nl[i].style.zIndex) : 0;
|
||||
|
||||
if (ci < 0 && nl[i] == le)
|
||||
ci = i;
|
||||
}
|
||||
|
||||
if (d < 0) {
|
||||
// Move back
|
||||
|
||||
// Try find a lower one
|
||||
for (i=0; i<z.length; i++) {
|
||||
if (z[i] < z[ci]) {
|
||||
fi = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fi > -1) {
|
||||
nl[ci].style.zIndex = z[fi];
|
||||
nl[fi].style.zIndex = z[ci];
|
||||
} else {
|
||||
if (z[ci] > 0)
|
||||
nl[ci].style.zIndex = z[ci] - 1;
|
||||
}
|
||||
} else {
|
||||
// Move forward
|
||||
|
||||
// Try find a higher one
|
||||
for (i=0; i<z.length; i++) {
|
||||
if (z[i] > z[ci]) {
|
||||
fi = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fi > -1) {
|
||||
nl[ci].style.zIndex = z[fi];
|
||||
nl[fi].style.zIndex = z[ci];
|
||||
} else
|
||||
nl[ci].style.zIndex = z[ci] + 1;
|
||||
}
|
||||
|
||||
ed.execCommand('mceRepaint');
|
||||
},
|
||||
|
||||
_getParentLayer : function(n) {
|
||||
return this.editor.dom.getParent(n, function(n) {
|
||||
return n.nodeType == 1 && /^(absolute|relative|static)$/i.test(n.style.position);
|
||||
});
|
||||
},
|
||||
|
||||
_insertLayer : function() {
|
||||
var ed = this.editor, dom = ed.dom, p = dom.getPos(dom.getParent(ed.selection.getNode(), '*')), body = ed.getBody();
|
||||
|
||||
ed.dom.add(body, 'div', {
|
||||
style : {
|
||||
position : 'absolute',
|
||||
left : p.x,
|
||||
top : (p.y > 20 ? p.y : 20),
|
||||
width : 100,
|
||||
height : 100
|
||||
},
|
||||
'class' : 'mceItemVisualAid mceItemLayer'
|
||||
}, ed.selection.getContent() || ed.getLang('layer.content'));
|
||||
|
||||
// Workaround for IE where it messes up the JS engine if you insert a layer on IE 6,7
|
||||
if (tinymce.isIE)
|
||||
dom.setHTML(body, body.innerHTML);
|
||||
},
|
||||
|
||||
_toggleAbsolute : function() {
|
||||
var ed = this.editor, le = this._getParentLayer(ed.selection.getNode());
|
||||
|
||||
if (!le)
|
||||
le = ed.dom.getParent(ed.selection.getNode(), 'DIV,P,IMG');
|
||||
|
||||
if (le) {
|
||||
if (le.style.position.toLowerCase() == "absolute") {
|
||||
ed.dom.setStyles(le, {
|
||||
position : '',
|
||||
left : '',
|
||||
top : '',
|
||||
width : '',
|
||||
height : ''
|
||||
});
|
||||
|
||||
ed.dom.removeClass(le, 'mceItemVisualAid');
|
||||
ed.dom.removeClass(le, 'mceItemLayer');
|
||||
} else {
|
||||
if (le.style.left == "")
|
||||
le.style.left = 20 + 'px';
|
||||
|
||||
if (le.style.top == "")
|
||||
le.style.top = 20 + 'px';
|
||||
|
||||
if (le.style.width == "")
|
||||
le.style.width = le.width ? (le.width + 'px') : '100px';
|
||||
|
||||
if (le.style.height == "")
|
||||
le.style.height = le.height ? (le.height + 'px') : '100px';
|
||||
|
||||
le.style.position = "absolute";
|
||||
|
||||
ed.dom.setAttrib(le, 'data-mce-style', '');
|
||||
ed.addVisual(ed.getBody());
|
||||
}
|
||||
|
||||
ed.execCommand('mceRepaint');
|
||||
ed.nodeChanged();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('layer', tinymce.plugins.Layer);
|
||||
})();
|
@ -1 +0,0 @@
|
||||
(function(a){a.onAddEditor.addToTop(function(c,b){b.settings.inline_styles=false});a.create("tinymce.plugins.LegacyOutput",{init:function(b){b.onInit.add(function(){var c="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",e=a.explode(b.settings.font_size_style_values),d=b.schema;b.formatter.register({alignleft:{selector:c,attributes:{align:"left"}},aligncenter:{selector:c,attributes:{align:"center"}},alignright:{selector:c,attributes:{align:"right"}},alignfull:{selector:c,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all"},{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all"},{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all"},{inline:"span",styles:{textDecoration:"underline"},exact:true}],strikethrough:[{inline:"strike",remove:"all"},{inline:"span",styles:{textDecoration:"line-through"},exact:true}],fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(f){return a.inArray(e,f.value)+1}}},forecolor:{inline:"font",attributes:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}});a.each("b,i,u,strike".split(","),function(f){d.addValidElements(f+"[*]")});if(!d.getElementRule("font")){d.addValidElements("font[face|size|color|style]")}a.each(c.split(","),function(f){var h=d.getElementRule(f),g;if(h){if(!h.attributes.align){h.attributes.align={};h.attributesOrder.push("align")}}});b.onNodeChange.add(function(g,k){var j,f,h,i;f=g.dom.getParent(g.selection.getNode(),"font");if(f){h=f.face;i=f.size}if(j=k.get("fontselect")){j.select(function(l){return l==h})}if(j=k.get("fontsizeselect")){j.select(function(m){var l=a.inArray(e,m.fontSize);return l+1==i})}})})},getInfo:function(){return{longname:"LegacyOutput",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/legacyoutput",version:a.majorVersion+"."+a.minorVersion}}});a.PluginManager.add("legacyoutput",a.plugins.LegacyOutput)})(tinymce);
|
@ -1 +0,0 @@
|
||||
(function(){tinymce.create("tinymce.plugins.Nonbreaking",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceNonBreaking",function(){a.execCommand("mceInsertContent",false,(a.plugins.visualchars&&a.plugins.visualchars.state)?'<span data-mce-bogus="1" class="mceItemHidden mceItemNbsp"> </span>':" ")});a.addButton("nonbreaking",{title:"nonbreaking.nonbreaking_desc",cmd:"mceNonBreaking"});if(a.getParam("nonbreaking_force_tab")){a.onKeyDown.add(function(d,f){if(f.keyCode==9){f.preventDefault();d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking")}})}},getInfo:function(){return{longname:"Nonbreaking space",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("nonbreaking",tinymce.plugins.Nonbreaking)})();
|
@ -1,74 +0,0 @@
|
||||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.PageBreakPlugin', {
|
||||
init : function(ed, url) {
|
||||
var pb = '<img src="' + ed.theme.url + '/img/trans.gif" class="mcePageBreak mceItemNoResize" />', cls = 'mcePageBreak', sep = ed.getParam('pagebreak_separator', '<!-- pagebreak -->'), pbRE;
|
||||
|
||||
pbRE = new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function(a) {return '\\' + a;}), 'g');
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mcePageBreak', function() {
|
||||
ed.execCommand('mceInsertContent', 0, pb);
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('pagebreak', {title : 'pagebreak.desc', cmd : cls});
|
||||
|
||||
ed.onInit.add(function() {
|
||||
if (ed.theme.onResolveName) {
|
||||
ed.theme.onResolveName.add(function(th, o) {
|
||||
if (o.node.nodeName == 'IMG' && ed.dom.hasClass(o.node, cls))
|
||||
o.name = 'pagebreak';
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
ed.onClick.add(function(ed, e) {
|
||||
e = e.target;
|
||||
|
||||
if (e.nodeName === 'IMG' && ed.dom.hasClass(e, cls))
|
||||
ed.selection.select(e);
|
||||
});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setActive('pagebreak', n.nodeName === 'IMG' && ed.dom.hasClass(n, cls));
|
||||
});
|
||||
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
o.content = o.content.replace(pbRE, pb);
|
||||
});
|
||||
|
||||
ed.onPostProcess.add(function(ed, o) {
|
||||
if (o.get)
|
||||
o.content = o.content.replace(/<img[^>]+>/g, function(im) {
|
||||
if (im.indexOf('class="mcePageBreak') !== -1)
|
||||
im = sep;
|
||||
|
||||
return im;
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'PageBreak',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('pagebreak', tinymce.plugins.PageBreakPlugin);
|
||||
})();
|
@ -1,436 +0,0 @@
|
||||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var JSONRequest = tinymce.util.JSONRequest, each = tinymce.each, DOM = tinymce.DOM;
|
||||
|
||||
tinymce.create('tinymce.plugins.SpellcheckerPlugin', {
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Spellchecker',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
init : function(ed, url) {
|
||||
var t = this, cm;
|
||||
|
||||
t.url = url;
|
||||
t.editor = ed;
|
||||
t.rpcUrl = ed.getParam("spellchecker_rpc_url", "{backend}");
|
||||
|
||||
if (t.rpcUrl == '{backend}') {
|
||||
// Sniff if the browser supports native spellchecking (Don't know of a better way)
|
||||
if (tinymce.isIE)
|
||||
return;
|
||||
|
||||
t.hasSupport = true;
|
||||
|
||||
// Disable the context menu when spellchecking is active
|
||||
ed.onContextMenu.addToTop(function(ed, e) {
|
||||
if (t.active)
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mceSpellCheck', function() {
|
||||
if (t.rpcUrl == '{backend}') {
|
||||
// Enable/disable native spellchecker
|
||||
t.editor.getBody().spellcheck = t.active = !t.active;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!t.active) {
|
||||
ed.setProgressState(1);
|
||||
t._sendRPC('checkWords', [t.selectedLang, t._getWords()], function(r) {
|
||||
if (r.length > 0) {
|
||||
t.active = 1;
|
||||
t._markWords(r);
|
||||
ed.setProgressState(0);
|
||||
ed.nodeChanged();
|
||||
} else {
|
||||
ed.setProgressState(0);
|
||||
|
||||
if (ed.getParam('spellchecker_report_no_misspellings', true))
|
||||
ed.windowManager.alert('spellchecker.no_mpell');
|
||||
}
|
||||
});
|
||||
} else
|
||||
t._done();
|
||||
});
|
||||
|
||||
if (ed.settings.content_css !== false)
|
||||
ed.contentCSS.push(url + '/css/content.css');
|
||||
|
||||
ed.onClick.add(t._showMenu, t);
|
||||
ed.onContextMenu.add(t._showMenu, t);
|
||||
ed.onBeforeGetContent.add(function() {
|
||||
if (t.active)
|
||||
t._removeWords();
|
||||
});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm) {
|
||||
cm.setActive('spellchecker', t.active);
|
||||
});
|
||||
|
||||
ed.onSetContent.add(function() {
|
||||
t._done();
|
||||
});
|
||||
|
||||
ed.onBeforeGetContent.add(function() {
|
||||
t._done();
|
||||
});
|
||||
|
||||
ed.onBeforeExecCommand.add(function(ed, cmd) {
|
||||
if (cmd == 'mceFullScreen')
|
||||
t._done();
|
||||
});
|
||||
|
||||
// Find selected language
|
||||
t.languages = {};
|
||||
each(ed.getParam('spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv', 'hash'), function(v, k) {
|
||||
if (k.indexOf('+') === 0) {
|
||||
k = k.substring(1);
|
||||
t.selectedLang = v;
|
||||
}
|
||||
|
||||
t.languages[k] = v;
|
||||
});
|
||||
},
|
||||
|
||||
createControl : function(n, cm) {
|
||||
var t = this, c, ed = t.editor;
|
||||
|
||||
if (n == 'spellchecker') {
|
||||
// Use basic button if we use the native spellchecker
|
||||
if (t.rpcUrl == '{backend}') {
|
||||
// Create simple toggle button if we have native support
|
||||
if (t.hasSupport)
|
||||
c = cm.createButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t});
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
c = cm.createSplitButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t});
|
||||
|
||||
c.onRenderMenu.add(function(c, m) {
|
||||
m.add({title : 'spellchecker.langs', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
|
||||
each(t.languages, function(v, k) {
|
||||
var o = {icon : 1}, mi;
|
||||
|
||||
o.onclick = function() {
|
||||
if (v == t.selectedLang) {
|
||||
return;
|
||||
}
|
||||
mi.setSelected(1);
|
||||
t.selectedItem.setSelected(0);
|
||||
t.selectedItem = mi;
|
||||
t.selectedLang = v;
|
||||
};
|
||||
|
||||
o.title = k;
|
||||
mi = m.add(o);
|
||||
mi.setSelected(v == t.selectedLang);
|
||||
|
||||
if (v == t.selectedLang)
|
||||
t.selectedItem = mi;
|
||||
})
|
||||
});
|
||||
|
||||
return c;
|
||||
}
|
||||
},
|
||||
|
||||
// Internal functions
|
||||
|
||||
_walk : function(n, f) {
|
||||
var d = this.editor.getDoc(), w;
|
||||
|
||||
if (d.createTreeWalker) {
|
||||
w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
|
||||
|
||||
while ((n = w.nextNode()) != null)
|
||||
f.call(this, n);
|
||||
} else
|
||||
tinymce.walk(n, f, 'childNodes');
|
||||
},
|
||||
|
||||
_getSeparators : function() {
|
||||
var re = '', i, str = this.editor.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');
|
||||
|
||||
// Build word separator regexp
|
||||
for (i=0; i<str.length; i++)
|
||||
re += '\\' + str.charAt(i);
|
||||
|
||||
return re;
|
||||
},
|
||||
|
||||
_getWords : function() {
|
||||
var ed = this.editor, wl = [], tx = '', lo = {}, rawWords = [];
|
||||
|
||||
// Get area text
|
||||
this._walk(ed.getBody(), function(n) {
|
||||
if (n.nodeType == 3)
|
||||
tx += n.nodeValue + ' ';
|
||||
});
|
||||
|
||||
// split the text up into individual words
|
||||
if (ed.getParam('spellchecker_word_pattern')) {
|
||||
// look for words that match the pattern
|
||||
rawWords = tx.match('(' + ed.getParam('spellchecker_word_pattern') + ')', 'gi');
|
||||
} else {
|
||||
// Split words by separator
|
||||
tx = tx.replace(new RegExp('([0-9]|[' + this._getSeparators() + '])', 'g'), ' ');
|
||||
tx = tinymce.trim(tx.replace(/(\s+)/g, ' '));
|
||||
rawWords = tx.split(' ');
|
||||
}
|
||||
|
||||
// Build word array and remove duplicates
|
||||
each(rawWords, function(v) {
|
||||
if (!lo[v]) {
|
||||
wl.push(v);
|
||||
lo[v] = 1;
|
||||
}
|
||||
});
|
||||
|
||||
return wl;
|
||||
},
|
||||
|
||||
_removeWords : function(w) {
|
||||
var ed = this.editor, dom = ed.dom, se = ed.selection, r = se.getRng(true);
|
||||
|
||||
each(dom.select('span').reverse(), function(n) {
|
||||
if (n && (dom.hasClass(n, 'mceItemHiddenSpellWord') || dom.hasClass(n, 'mceItemHidden'))) {
|
||||
if (!w || dom.decode(n.innerHTML) == w)
|
||||
dom.remove(n, 1);
|
||||
}
|
||||
});
|
||||
|
||||
se.setRng(r);
|
||||
},
|
||||
|
||||
_markWords : function(wl) {
|
||||
var ed = this.editor, dom = ed.dom, doc = ed.getDoc(), se = ed.selection, r = se.getRng(true), nl = [],
|
||||
w = wl.join('|'), re = this._getSeparators(), rx = new RegExp('(^|[' + re + '])(' + w + ')(?=[' + re + ']|$)', 'g');
|
||||
|
||||
// Collect all text nodes
|
||||
this._walk(ed.getBody(), function(n) {
|
||||
if (n.nodeType == 3) {
|
||||
nl.push(n);
|
||||
}
|
||||
});
|
||||
|
||||
// Wrap incorrect words in spans
|
||||
each(nl, function(n) {
|
||||
var node, elem, txt, pos, v = n.nodeValue;
|
||||
|
||||
if (rx.test(v)) {
|
||||
// Encode the content
|
||||
v = dom.encode(v);
|
||||
// Create container element
|
||||
elem = dom.create('span', {'class' : 'mceItemHidden'});
|
||||
|
||||
// Following code fixes IE issues by creating text nodes
|
||||
// using DOM methods instead of innerHTML.
|
||||
// Bug #3124: <PRE> elements content is broken after spellchecking.
|
||||
// Bug #1408: Preceding whitespace characters are removed
|
||||
// @TODO: I'm not sure that both are still issues on IE9.
|
||||
if (tinymce.isIE) {
|
||||
// Enclose mispelled words with temporal tag
|
||||
v = v.replace(rx, '$1<mcespell>$2</mcespell>');
|
||||
// Loop over the content finding mispelled words
|
||||
while ((pos = v.indexOf('<mcespell>')) != -1) {
|
||||
// Add text node for the content before the word
|
||||
txt = v.substring(0, pos);
|
||||
if (txt.length) {
|
||||
node = doc.createTextNode(dom.decode(txt));
|
||||
elem.appendChild(node);
|
||||
}
|
||||
v = v.substring(pos+10);
|
||||
pos = v.indexOf('</mcespell>');
|
||||
txt = v.substring(0, pos);
|
||||
v = v.substring(pos+11);
|
||||
// Add span element for the word
|
||||
elem.appendChild(dom.create('span', {'class' : 'mceItemHiddenSpellWord'}, txt));
|
||||
}
|
||||
// Add text node for the rest of the content
|
||||
if (v.length) {
|
||||
node = doc.createTextNode(dom.decode(v));
|
||||
elem.appendChild(node);
|
||||
}
|
||||
} else {
|
||||
// Other browsers preserve whitespace characters on innerHTML usage
|
||||
elem.innerHTML = v.replace(rx, '$1<span class="mceItemHiddenSpellWord">$2</span>');
|
||||
}
|
||||
|
||||
// Finally, replace the node with the container
|
||||
dom.replace(elem, n);
|
||||
}
|
||||
});
|
||||
|
||||
se.setRng(r);
|
||||
},
|
||||
|
||||
_showMenu : function(ed, e) {
|
||||
var t = this, ed = t.editor, m = t._menu, p1, dom = ed.dom, vp = dom.getViewPort(ed.getWin()), wordSpan = e.target;
|
||||
|
||||
e = 0; // Fixes IE memory leak
|
||||
|
||||
if (!m) {
|
||||
m = ed.controlManager.createDropMenu('spellcheckermenu', {'class' : 'mceNoIcons'});
|
||||
t._menu = m;
|
||||
}
|
||||
|
||||
if (dom.hasClass(wordSpan, 'mceItemHiddenSpellWord')) {
|
||||
m.removeAll();
|
||||
m.add({title : 'spellchecker.wait', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
|
||||
|
||||
t._sendRPC('getSuggestions', [t.selectedLang, dom.decode(wordSpan.innerHTML)], function(r) {
|
||||
var ignoreRpc;
|
||||
|
||||
m.removeAll();
|
||||
|
||||
if (r.length > 0) {
|
||||
m.add({title : 'spellchecker.sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
|
||||
each(r, function(v) {
|
||||
m.add({title : v, onclick : function() {
|
||||
dom.replace(ed.getDoc().createTextNode(v), wordSpan);
|
||||
t._checkDone();
|
||||
}});
|
||||
});
|
||||
|
||||
m.addSeparator();
|
||||
} else
|
||||
m.add({title : 'spellchecker.no_sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
|
||||
|
||||
if (ed.getParam('show_ignore_words', true)) {
|
||||
ignoreRpc = t.editor.getParam("spellchecker_enable_ignore_rpc", '');
|
||||
m.add({
|
||||
title : 'spellchecker.ignore_word',
|
||||
onclick : function() {
|
||||
var word = wordSpan.innerHTML;
|
||||
|
||||
dom.remove(wordSpan, 1);
|
||||
t._checkDone();
|
||||
|
||||
// tell the server if we need to
|
||||
if (ignoreRpc) {
|
||||
ed.setProgressState(1);
|
||||
t._sendRPC('ignoreWord', [t.selectedLang, word], function(r) {
|
||||
ed.setProgressState(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
m.add({
|
||||
title : 'spellchecker.ignore_words',
|
||||
onclick : function() {
|
||||
var word = wordSpan.innerHTML;
|
||||
|
||||
t._removeWords(dom.decode(word));
|
||||
t._checkDone();
|
||||
|
||||
// tell the server if we need to
|
||||
if (ignoreRpc) {
|
||||
ed.setProgressState(1);
|
||||
t._sendRPC('ignoreWords', [t.selectedLang, word], function(r) {
|
||||
ed.setProgressState(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (t.editor.getParam("spellchecker_enable_learn_rpc")) {
|
||||
m.add({
|
||||
title : 'spellchecker.learn_word',
|
||||
onclick : function() {
|
||||
var word = wordSpan.innerHTML;
|
||||
|
||||
dom.remove(wordSpan, 1);
|
||||
t._checkDone();
|
||||
|
||||
ed.setProgressState(1);
|
||||
t._sendRPC('learnWord', [t.selectedLang, word], function(r) {
|
||||
ed.setProgressState(0);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
m.update();
|
||||
});
|
||||
|
||||
p1 = DOM.getPos(ed.getContentAreaContainer());
|
||||
m.settings.offset_x = p1.x;
|
||||
m.settings.offset_y = p1.y;
|
||||
|
||||
ed.selection.select(wordSpan);
|
||||
p1 = dom.getPos(wordSpan);
|
||||
m.showMenu(p1.x, p1.y + wordSpan.offsetHeight - vp.y);
|
||||
|
||||
return tinymce.dom.Event.cancel(e);
|
||||
} else
|
||||
m.hideMenu();
|
||||
},
|
||||
|
||||
_checkDone : function() {
|
||||
var t = this, ed = t.editor, dom = ed.dom, o;
|
||||
|
||||
each(dom.select('span'), function(n) {
|
||||
if (n && dom.hasClass(n, 'mceItemHiddenSpellWord')) {
|
||||
o = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (!o)
|
||||
t._done();
|
||||
},
|
||||
|
||||
_done : function() {
|
||||
var t = this, la = t.active;
|
||||
|
||||
if (t.active) {
|
||||
t.active = 0;
|
||||
t._removeWords();
|
||||
|
||||
if (t._menu)
|
||||
t._menu.hideMenu();
|
||||
|
||||
if (la)
|
||||
t.editor.nodeChanged();
|
||||
}
|
||||
},
|
||||
|
||||
_sendRPC : function(m, p, cb) {
|
||||
var t = this;
|
||||
|
||||
JSONRequest.sendRPC({
|
||||
url : t.rpcUrl,
|
||||
method : m,
|
||||
params : p,
|
||||
success : cb,
|
||||
error : function(e, x) {
|
||||
t.editor.setProgressState(0);
|
||||
t.editor.windowManager.alert(e.errstr || ('Error response: ' + x.responseText));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin);
|
||||
})();
|
@ -1,71 +0,0 @@
|
||||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.StylePlugin', {
|
||||
init : function(ed, url) {
|
||||
// Register commands
|
||||
ed.addCommand('mceStyleProps', function() {
|
||||
|
||||
var applyStyleToBlocks = false;
|
||||
var blocks = ed.selection.getSelectedBlocks();
|
||||
var styles = [];
|
||||
|
||||
if (blocks.length === 1) {
|
||||
styles.push(ed.selection.getNode().style.cssText);
|
||||
}
|
||||
else {
|
||||
tinymce.each(blocks, function(block) {
|
||||
styles.push(ed.dom.getAttrib(block, 'style'));
|
||||
});
|
||||
applyStyleToBlocks = true;
|
||||
}
|
||||
|
||||
ed.windowManager.open({
|
||||
file : url + '/props.htm',
|
||||
width : 480 + parseInt(ed.getLang('style.delta_width', 0)),
|
||||
height : 340 + parseInt(ed.getLang('style.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
applyStyleToBlocks : applyStyleToBlocks,
|
||||
plugin_url : url,
|
||||
styles : styles
|
||||
});
|
||||
});
|
||||
|
||||
ed.addCommand('mceSetElementStyle', function(ui, v) {
|
||||
if (e = ed.selection.getNode()) {
|
||||
ed.dom.setAttrib(e, 'style', v);
|
||||
ed.execCommand('mceRepaint');
|
||||
}
|
||||
});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setDisabled('styleprops', n.nodeName === 'BODY');
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Style',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin);
|
||||
})();
|
@ -1,709 +0,0 @@
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var defaultFonts = "" +
|
||||
"Arial, Helvetica, sans-serif=Arial, Helvetica, sans-serif;" +
|
||||
"Times New Roman, Times, serif=Times New Roman, Times, serif;" +
|
||||
"Courier New, Courier, mono=Courier New, Courier, mono;" +
|
||||
"Times New Roman, Times, serif=Times New Roman, Times, serif;" +
|
||||
"Georgia, Times New Roman, Times, serif=Georgia, Times New Roman, Times, serif;" +
|
||||
"Verdana, Arial, Helvetica, sans-serif=Verdana, Arial, Helvetica, sans-serif;" +
|
||||
"Geneva, Arial, Helvetica, sans-serif=Geneva, Arial, Helvetica, sans-serif";
|
||||
|
||||
var defaultSizes = "9;10;12;14;16;18;24;xx-small;x-small;small;medium;large;x-large;xx-large;smaller;larger";
|
||||
var defaultMeasurement = "+pixels=px;points=pt;inches=in;centimetres=cm;millimetres=mm;picas=pc;ems=em;exs=ex;%";
|
||||
var defaultSpacingMeasurement = "pixels=px;points=pt;inches=in;centimetres=cm;millimetres=mm;picas=pc;+ems=em;exs=ex;%";
|
||||
var defaultIndentMeasurement = "pixels=px;+points=pt;inches=in;centimetres=cm;millimetres=mm;picas=pc;ems=em;exs=ex;%";
|
||||
var defaultWeight = "normal;bold;bolder;lighter;100;200;300;400;500;600;700;800;900";
|
||||
var defaultTextStyle = "normal;italic;oblique";
|
||||
var defaultVariant = "normal;small-caps";
|
||||
var defaultLineHeight = "normal";
|
||||
var defaultAttachment = "fixed;scroll";
|
||||
var defaultRepeat = "no-repeat;repeat;repeat-x;repeat-y";
|
||||
var defaultPosH = "left;center;right";
|
||||
var defaultPosV = "top;center;bottom";
|
||||
var defaultVAlign = "baseline;sub;super;top;text-top;middle;bottom;text-bottom";
|
||||
var defaultDisplay = "inline;block;list-item;run-in;compact;marker;table;inline-table;table-row-group;table-header-group;table-footer-group;table-row;table-column-group;table-column;table-cell;table-caption;none";
|
||||
var defaultBorderStyle = "none;solid;dashed;dotted;double;groove;ridge;inset;outset";
|
||||
var defaultBorderWidth = "thin;medium;thick";
|
||||
var defaultListType = "disc;circle;square;decimal;lower-roman;upper-roman;lower-alpha;upper-alpha;none";
|
||||
|
||||
function aggregateStyles(allStyles) {
|
||||
var mergedStyles = {};
|
||||
|
||||
tinymce.each(allStyles, function(style) {
|
||||
if (style !== '') {
|
||||
var parsedStyles = tinyMCEPopup.editor.dom.parseStyle(style);
|
||||
for (var name in parsedStyles) {
|
||||
if (parsedStyles.hasOwnProperty(name)) {
|
||||
if (mergedStyles[name] === undefined) {
|
||||
mergedStyles[name] = parsedStyles[name];
|
||||
}
|
||||
else if (name === 'text-decoration') {
|
||||
if (mergedStyles[name].indexOf(parsedStyles[name]) === -1) {
|
||||
mergedStyles[name] = mergedStyles[name] +' '+ parsedStyles[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return mergedStyles;
|
||||
}
|
||||
|
||||
var applyActionIsInsert;
|
||||
var existingStyles;
|
||||
|
||||
function init(ed) {
|
||||
var ce = document.getElementById('container'), h;
|
||||
|
||||
existingStyles = aggregateStyles(tinyMCEPopup.getWindowArg('styles'));
|
||||
ce.style.cssText = tinyMCEPopup.editor.dom.serializeStyle(existingStyles);
|
||||
|
||||
applyActionIsInsert = ed.getParam("edit_css_style_insert_span", false);
|
||||
document.getElementById('toggle_insert_span').checked = applyActionIsInsert;
|
||||
|
||||
h = getBrowserHTML('background_image_browser','background_image','image','advimage');
|
||||
document.getElementById("background_image_browser").innerHTML = h;
|
||||
|
||||
document.getElementById('text_color_pickcontainer').innerHTML = getColorPickerHTML('text_color_pick','text_color');
|
||||
document.getElementById('background_color_pickcontainer').innerHTML = getColorPickerHTML('background_color_pick','background_color');
|
||||
document.getElementById('border_color_top_pickcontainer').innerHTML = getColorPickerHTML('border_color_top_pick','border_color_top');
|
||||
document.getElementById('border_color_right_pickcontainer').innerHTML = getColorPickerHTML('border_color_right_pick','border_color_right');
|
||||
document.getElementById('border_color_bottom_pickcontainer').innerHTML = getColorPickerHTML('border_color_bottom_pick','border_color_bottom');
|
||||
document.getElementById('border_color_left_pickcontainer').innerHTML = getColorPickerHTML('border_color_left_pick','border_color_left');
|
||||
|
||||
fillSelect(0, 'text_font', 'style_font', defaultFonts, ';', true);
|
||||
fillSelect(0, 'text_size', 'style_font_size', defaultSizes, ';', true);
|
||||
fillSelect(0, 'text_size_measurement', 'style_font_size_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'text_case', 'style_text_case', "capitalize;uppercase;lowercase", ';', true);
|
||||
fillSelect(0, 'text_weight', 'style_font_weight', defaultWeight, ';', true);
|
||||
fillSelect(0, 'text_style', 'style_font_style', defaultTextStyle, ';', true);
|
||||
fillSelect(0, 'text_variant', 'style_font_variant', defaultVariant, ';', true);
|
||||
fillSelect(0, 'text_lineheight', 'style_font_line_height', defaultLineHeight, ';', true);
|
||||
fillSelect(0, 'text_lineheight_measurement', 'style_font_line_height_measurement', defaultMeasurement, ';', true);
|
||||
|
||||
fillSelect(0, 'background_attachment', 'style_background_attachment', defaultAttachment, ';', true);
|
||||
fillSelect(0, 'background_repeat', 'style_background_repeat', defaultRepeat, ';', true);
|
||||
|
||||
fillSelect(0, 'background_hpos_measurement', 'style_background_hpos_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'background_vpos_measurement', 'style_background_vpos_measurement', defaultMeasurement, ';', true);
|
||||
|
||||
fillSelect(0, 'background_hpos', 'style_background_hpos', defaultPosH, ';', true);
|
||||
fillSelect(0, 'background_vpos', 'style_background_vpos', defaultPosV, ';', true);
|
||||
|
||||
fillSelect(0, 'block_wordspacing', 'style_wordspacing', 'normal', ';', true);
|
||||
fillSelect(0, 'block_wordspacing_measurement', 'style_wordspacing_measurement', defaultSpacingMeasurement, ';', true);
|
||||
fillSelect(0, 'block_letterspacing', 'style_letterspacing', 'normal', ';', true);
|
||||
fillSelect(0, 'block_letterspacing_measurement', 'style_letterspacing_measurement', defaultSpacingMeasurement, ';', true);
|
||||
fillSelect(0, 'block_vertical_alignment', 'style_vertical_alignment', defaultVAlign, ';', true);
|
||||
fillSelect(0, 'block_text_align', 'style_text_align', "left;right;center;justify", ';', true);
|
||||
fillSelect(0, 'block_whitespace', 'style_whitespace', "normal;pre;nowrap", ';', true);
|
||||
fillSelect(0, 'block_display', 'style_display', defaultDisplay, ';', true);
|
||||
fillSelect(0, 'block_text_indent_measurement', 'style_text_indent_measurement', defaultIndentMeasurement, ';', true);
|
||||
|
||||
fillSelect(0, 'box_width_measurement', 'style_box_width_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_height_measurement', 'style_box_height_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_float', 'style_float', 'left;right;none', ';', true);
|
||||
fillSelect(0, 'box_clear', 'style_clear', 'left;right;both;none', ';', true);
|
||||
fillSelect(0, 'box_padding_left_measurement', 'style_padding_left_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_padding_top_measurement', 'style_padding_top_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_padding_bottom_measurement', 'style_padding_bottom_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_padding_right_measurement', 'style_padding_right_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_margin_left_measurement', 'style_margin_left_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_margin_top_measurement', 'style_margin_top_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_margin_bottom_measurement', 'style_margin_bottom_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_margin_right_measurement', 'style_margin_right_measurement', defaultMeasurement, ';', true);
|
||||
|
||||
fillSelect(0, 'border_style_top', 'style_border_style_top', defaultBorderStyle, ';', true);
|
||||
fillSelect(0, 'border_style_right', 'style_border_style_right', defaultBorderStyle, ';', true);
|
||||
fillSelect(0, 'border_style_bottom', 'style_border_style_bottom', defaultBorderStyle, ';', true);
|
||||
fillSelect(0, 'border_style_left', 'style_border_style_left', defaultBorderStyle, ';', true);
|
||||
|
||||
fillSelect(0, 'border_width_top', 'style_border_width_top', defaultBorderWidth, ';', true);
|
||||
fillSelect(0, 'border_width_right', 'style_border_width_right', defaultBorderWidth, ';', true);
|
||||
fillSelect(0, 'border_width_bottom', 'style_border_width_bottom', defaultBorderWidth, ';', true);
|
||||
fillSelect(0, 'border_width_left', 'style_border_width_left', defaultBorderWidth, ';', true);
|
||||
|
||||
fillSelect(0, 'border_width_top_measurement', 'style_border_width_top_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'border_width_right_measurement', 'style_border_width_right_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'border_width_bottom_measurement', 'style_border_width_bottom_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'border_width_left_measurement', 'style_border_width_left_measurement', defaultMeasurement, ';', true);
|
||||
|
||||
fillSelect(0, 'list_type', 'style_list_type', defaultListType, ';', true);
|
||||
fillSelect(0, 'list_position', 'style_list_position', "inside;outside", ';', true);
|
||||
|
||||
fillSelect(0, 'positioning_type', 'style_positioning_type', "absolute;relative;static", ';', true);
|
||||
fillSelect(0, 'positioning_visibility', 'style_positioning_visibility', "inherit;visible;hidden", ';', true);
|
||||
|
||||
fillSelect(0, 'positioning_width_measurement', 'style_positioning_width_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'positioning_height_measurement', 'style_positioning_height_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'positioning_overflow', 'style_positioning_overflow', "visible;hidden;scroll;auto", ';', true);
|
||||
|
||||
fillSelect(0, 'positioning_placement_top_measurement', 'style_positioning_placement_top_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'positioning_placement_right_measurement', 'style_positioning_placement_right_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'positioning_placement_bottom_measurement', 'style_positioning_placement_bottom_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'positioning_placement_left_measurement', 'style_positioning_placement_left_measurement', defaultMeasurement, ';', true);
|
||||
|
||||
fillSelect(0, 'positioning_clip_top_measurement', 'style_positioning_clip_top_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'positioning_clip_right_measurement', 'style_positioning_clip_right_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'positioning_clip_bottom_measurement', 'style_positioning_clip_bottom_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'positioning_clip_left_measurement', 'style_positioning_clip_left_measurement', defaultMeasurement, ';', true);
|
||||
|
||||
TinyMCE_EditableSelects.init();
|
||||
setupFormData();
|
||||
showDisabledControls();
|
||||
}
|
||||
|
||||
function setupFormData() {
|
||||
var ce = document.getElementById('container'), f = document.forms[0], s, b, i;
|
||||
|
||||
// Setup text fields
|
||||
|
||||
selectByValue(f, 'text_font', ce.style.fontFamily, true, true);
|
||||
selectByValue(f, 'text_size', getNum(ce.style.fontSize), true, true);
|
||||
selectByValue(f, 'text_size_measurement', getMeasurement(ce.style.fontSize));
|
||||
selectByValue(f, 'text_weight', ce.style.fontWeight, true, true);
|
||||
selectByValue(f, 'text_style', ce.style.fontStyle, true, true);
|
||||
selectByValue(f, 'text_lineheight', getNum(ce.style.lineHeight), true, true);
|
||||
selectByValue(f, 'text_lineheight_measurement', getMeasurement(ce.style.lineHeight));
|
||||
selectByValue(f, 'text_case', ce.style.textTransform, true, true);
|
||||
selectByValue(f, 'text_variant', ce.style.fontVariant, true, true);
|
||||
f.text_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.color);
|
||||
updateColor('text_color_pick', 'text_color');
|
||||
f.text_underline.checked = inStr(ce.style.textDecoration, 'underline');
|
||||
f.text_overline.checked = inStr(ce.style.textDecoration, 'overline');
|
||||
f.text_linethrough.checked = inStr(ce.style.textDecoration, 'line-through');
|
||||
f.text_blink.checked = inStr(ce.style.textDecoration, 'blink');
|
||||
f.text_none.checked = inStr(ce.style.textDecoration, 'none');
|
||||
updateTextDecorations();
|
||||
|
||||
// Setup background fields
|
||||
|
||||
f.background_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.backgroundColor);
|
||||
updateColor('background_color_pick', 'background_color');
|
||||
f.background_image.value = ce.style.backgroundImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
|
||||
selectByValue(f, 'background_repeat', ce.style.backgroundRepeat, true, true);
|
||||
selectByValue(f, 'background_attachment', ce.style.backgroundAttachment, true, true);
|
||||
selectByValue(f, 'background_hpos', getNum(getVal(ce.style.backgroundPosition, 0)), true, true);
|
||||
selectByValue(f, 'background_hpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 0)));
|
||||
selectByValue(f, 'background_vpos', getNum(getVal(ce.style.backgroundPosition, 1)), true, true);
|
||||
selectByValue(f, 'background_vpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 1)));
|
||||
|
||||
// Setup block fields
|
||||
|
||||
selectByValue(f, 'block_wordspacing', getNum(ce.style.wordSpacing), true, true);
|
||||
selectByValue(f, 'block_wordspacing_measurement', getMeasurement(ce.style.wordSpacing));
|
||||
selectByValue(f, 'block_letterspacing', getNum(ce.style.letterSpacing), true, true);
|
||||
selectByValue(f, 'block_letterspacing_measurement', getMeasurement(ce.style.letterSpacing));
|
||||
selectByValue(f, 'block_vertical_alignment', ce.style.verticalAlign, true, true);
|
||||
selectByValue(f, 'block_text_align', ce.style.textAlign, true, true);
|
||||
f.block_text_indent.value = getNum(ce.style.textIndent);
|
||||
selectByValue(f, 'block_text_indent_measurement', getMeasurement(ce.style.textIndent));
|
||||
selectByValue(f, 'block_whitespace', ce.style.whiteSpace, true, true);
|
||||
selectByValue(f, 'block_display', ce.style.display, true, true);
|
||||
|
||||
// Setup box fields
|
||||
|
||||
f.box_width.value = getNum(ce.style.width);
|
||||
selectByValue(f, 'box_width_measurement', getMeasurement(ce.style.width));
|
||||
|
||||
f.box_height.value = getNum(ce.style.height);
|
||||
selectByValue(f, 'box_height_measurement', getMeasurement(ce.style.height));
|
||||
selectByValue(f, 'box_float', ce.style.cssFloat || ce.style.styleFloat, true, true);
|
||||
|
||||
selectByValue(f, 'box_clear', ce.style.clear, true, true);
|
||||
|
||||
setupBox(f, ce, 'box_padding', 'padding', '');
|
||||
setupBox(f, ce, 'box_margin', 'margin', '');
|
||||
|
||||
// Setup border fields
|
||||
|
||||
setupBox(f, ce, 'border_style', 'border', 'Style');
|
||||
setupBox(f, ce, 'border_width', 'border', 'Width');
|
||||
setupBox(f, ce, 'border_color', 'border', 'Color');
|
||||
|
||||
updateColor('border_color_top_pick', 'border_color_top');
|
||||
updateColor('border_color_right_pick', 'border_color_right');
|
||||
updateColor('border_color_bottom_pick', 'border_color_bottom');
|
||||
updateColor('border_color_left_pick', 'border_color_left');
|
||||
|
||||
f.elements.border_color_top.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_top.value);
|
||||
f.elements.border_color_right.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_right.value);
|
||||
f.elements.border_color_bottom.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_bottom.value);
|
||||
f.elements.border_color_left.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_left.value);
|
||||
|
||||
// Setup list fields
|
||||
|
||||
selectByValue(f, 'list_type', ce.style.listStyleType, true, true);
|
||||
selectByValue(f, 'list_position', ce.style.listStylePosition, true, true);
|
||||
f.list_bullet_image.value = ce.style.listStyleImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
|
||||
|
||||
// Setup box fields
|
||||
|
||||
selectByValue(f, 'positioning_type', ce.style.position, true, true);
|
||||
selectByValue(f, 'positioning_visibility', ce.style.visibility, true, true);
|
||||
selectByValue(f, 'positioning_overflow', ce.style.overflow, true, true);
|
||||
f.positioning_zindex.value = ce.style.zIndex ? ce.style.zIndex : "";
|
||||
|
||||
f.positioning_width.value = getNum(ce.style.width);
|
||||
selectByValue(f, 'positioning_width_measurement', getMeasurement(ce.style.width));
|
||||
|
||||
f.positioning_height.value = getNum(ce.style.height);
|
||||
selectByValue(f, 'positioning_height_measurement', getMeasurement(ce.style.height));
|
||||
|
||||
setupBox(f, ce, 'positioning_placement', '', '', ['top', 'right', 'bottom', 'left']);
|
||||
|
||||
s = ce.style.clip.replace(new RegExp("rect\\('?([^']*)'?\\)", 'gi'), "$1");
|
||||
s = s.replace(/,/g, ' ');
|
||||
|
||||
if (!hasEqualValues([getVal(s, 0), getVal(s, 1), getVal(s, 2), getVal(s, 3)])) {
|
||||
f.positioning_clip_top.value = getNum(getVal(s, 0));
|
||||
selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0)));
|
||||
f.positioning_clip_right.value = getNum(getVal(s, 1));
|
||||
selectByValue(f, 'positioning_clip_right_measurement', getMeasurement(getVal(s, 1)));
|
||||
f.positioning_clip_bottom.value = getNum(getVal(s, 2));
|
||||
selectByValue(f, 'positioning_clip_bottom_measurement', getMeasurement(getVal(s, 2)));
|
||||
f.positioning_clip_left.value = getNum(getVal(s, 3));
|
||||
selectByValue(f, 'positioning_clip_left_measurement', getMeasurement(getVal(s, 3)));
|
||||
} else {
|
||||
f.positioning_clip_top.value = getNum(getVal(s, 0));
|
||||
selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0)));
|
||||
f.positioning_clip_right.value = f.positioning_clip_bottom.value = f.positioning_clip_left.value;
|
||||
}
|
||||
|
||||
// setupBox(f, ce, '', 'border', 'Color');
|
||||
}
|
||||
|
||||
function getMeasurement(s) {
|
||||
return s.replace(/^([0-9.]+)(.*)$/, "$2");
|
||||
}
|
||||
|
||||
function getNum(s) {
|
||||
if (new RegExp('^(?:[0-9.]+)(?:[a-z%]+)$', 'gi').test(s))
|
||||
return s.replace(/[^0-9.]/g, '');
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
function inStr(s, n) {
|
||||
return new RegExp(n, 'gi').test(s);
|
||||
}
|
||||
|
||||
function getVal(s, i) {
|
||||
var a = s.split(' ');
|
||||
|
||||
if (a.length > 1)
|
||||
return a[i];
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function setValue(f, n, v) {
|
||||
if (f.elements[n].type == "text")
|
||||
f.elements[n].value = v;
|
||||
else
|
||||
selectByValue(f, n, v, true, true);
|
||||
}
|
||||
|
||||
function setupBox(f, ce, fp, pr, sf, b) {
|
||||
if (typeof(b) == "undefined")
|
||||
b = ['Top', 'Right', 'Bottom', 'Left'];
|
||||
|
||||
if (isSame(ce, pr, sf, b)) {
|
||||
f.elements[fp + "_same"].checked = true;
|
||||
|
||||
setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf]));
|
||||
f.elements[fp + "_top"].disabled = false;
|
||||
|
||||
f.elements[fp + "_right"].value = "";
|
||||
f.elements[fp + "_right"].disabled = true;
|
||||
f.elements[fp + "_bottom"].value = "";
|
||||
f.elements[fp + "_bottom"].disabled = true;
|
||||
f.elements[fp + "_left"].value = "";
|
||||
f.elements[fp + "_left"].disabled = true;
|
||||
|
||||
if (f.elements[fp + "_top_measurement"]) {
|
||||
selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf]));
|
||||
f.elements[fp + "_left_measurement"].disabled = true;
|
||||
f.elements[fp + "_bottom_measurement"].disabled = true;
|
||||
f.elements[fp + "_right_measurement"].disabled = true;
|
||||
}
|
||||
} else {
|
||||
f.elements[fp + "_same"].checked = false;
|
||||
|
||||
setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf]));
|
||||
f.elements[fp + "_top"].disabled = false;
|
||||
|
||||
setValue(f, fp + "_right", getNum(ce.style[pr + b[1] + sf]));
|
||||
f.elements[fp + "_right"].disabled = false;
|
||||
|
||||
setValue(f, fp + "_bottom", getNum(ce.style[pr + b[2] + sf]));
|
||||
f.elements[fp + "_bottom"].disabled = false;
|
||||
|
||||
setValue(f, fp + "_left", getNum(ce.style[pr + b[3] + sf]));
|
||||
f.elements[fp + "_left"].disabled = false;
|
||||
|
||||
if (f.elements[fp + "_top_measurement"]) {
|
||||
selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf]));
|
||||
selectByValue(f, fp + '_right_measurement', getMeasurement(ce.style[pr + b[1] + sf]));
|
||||
selectByValue(f, fp + '_bottom_measurement', getMeasurement(ce.style[pr + b[2] + sf]));
|
||||
selectByValue(f, fp + '_left_measurement', getMeasurement(ce.style[pr + b[3] + sf]));
|
||||
f.elements[fp + "_left_measurement"].disabled = false;
|
||||
f.elements[fp + "_bottom_measurement"].disabled = false;
|
||||
f.elements[fp + "_right_measurement"].disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isSame(e, pr, sf, b) {
|
||||
var a = [], i, x;
|
||||
|
||||
if (typeof(b) == "undefined")
|
||||
b = ['Top', 'Right', 'Bottom', 'Left'];
|
||||
|
||||
if (typeof(sf) == "undefined" || sf == null)
|
||||
sf = "";
|
||||
|
||||
a[0] = e.style[pr + b[0] + sf];
|
||||
a[1] = e.style[pr + b[1] + sf];
|
||||
a[2] = e.style[pr + b[2] + sf];
|
||||
a[3] = e.style[pr + b[3] + sf];
|
||||
|
||||
for (i=0; i<a.length; i++) {
|
||||
if (a[i] == null)
|
||||
return false;
|
||||
|
||||
for (x=0; x<a.length; x++) {
|
||||
if (a[x] != a[i])
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
function hasEqualValues(a) {
|
||||
var i, x;
|
||||
|
||||
for (i=0; i<a.length; i++) {
|
||||
if (a[i] == null)
|
||||
return false;
|
||||
|
||||
for (x=0; x<a.length; x++) {
|
||||
if (a[x] != a[i])
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function toggleApplyAction() {
|
||||
applyActionIsInsert = ! applyActionIsInsert;
|
||||
}
|
||||
|
||||
function applyAction() {
|
||||
var ce = document.getElementById('container'), ed = tinyMCEPopup.editor;
|
||||
|
||||
generateCSS();
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
|
||||
var newStyles = tinyMCEPopup.editor.dom.parseStyle(ce.style.cssText);
|
||||
|
||||
if (applyActionIsInsert) {
|
||||
ed.formatter.register('plugin_style', {
|
||||
inline: 'span', styles: existingStyles
|
||||
});
|
||||
ed.formatter.remove('plugin_style');
|
||||
|
||||
ed.formatter.register('plugin_style', {
|
||||
inline: 'span', styles: newStyles
|
||||
});
|
||||
ed.formatter.apply('plugin_style');
|
||||
} else {
|
||||
var nodes;
|
||||
|
||||
if (tinyMCEPopup.getWindowArg('applyStyleToBlocks')) {
|
||||
nodes = ed.selection.getSelectedBlocks();
|
||||
}
|
||||
else {
|
||||
nodes = ed.selection.getNode();
|
||||
}
|
||||
|
||||
ed.dom.setAttrib(nodes, 'style', tinyMCEPopup.editor.dom.serializeStyle(newStyles));
|
||||
}
|
||||
}
|
||||
|
||||
function updateAction() {
|
||||
applyAction();
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
function generateCSS() {
|
||||
var ce = document.getElementById('container'), f = document.forms[0], num = new RegExp('[0-9]+', 'g'), s, t;
|
||||
|
||||
ce.style.cssText = "";
|
||||
|
||||
// Build text styles
|
||||
ce.style.fontFamily = f.text_font.value;
|
||||
ce.style.fontSize = f.text_size.value + (isNum(f.text_size.value) ? (f.text_size_measurement.value || 'px') : "");
|
||||
ce.style.fontStyle = f.text_style.value;
|
||||
ce.style.lineHeight = f.text_lineheight.value + (isNum(f.text_lineheight.value) ? f.text_lineheight_measurement.value : "");
|
||||
ce.style.textTransform = f.text_case.value;
|
||||
ce.style.fontWeight = f.text_weight.value;
|
||||
ce.style.fontVariant = f.text_variant.value;
|
||||
ce.style.color = f.text_color.value;
|
||||
|
||||
s = "";
|
||||
s += f.text_underline.checked ? " underline" : "";
|
||||
s += f.text_overline.checked ? " overline" : "";
|
||||
s += f.text_linethrough.checked ? " line-through" : "";
|
||||
s += f.text_blink.checked ? " blink" : "";
|
||||
s = s.length > 0 ? s.substring(1) : s;
|
||||
|
||||
if (f.text_none.checked)
|
||||
s = "none";
|
||||
|
||||
ce.style.textDecoration = s;
|
||||
|
||||
// Build background styles
|
||||
|
||||
ce.style.backgroundColor = f.background_color.value;
|
||||
ce.style.backgroundImage = f.background_image.value != "" ? "url(" + f.background_image.value + ")" : "";
|
||||
ce.style.backgroundRepeat = f.background_repeat.value;
|
||||
ce.style.backgroundAttachment = f.background_attachment.value;
|
||||
|
||||
if (f.background_hpos.value != "") {
|
||||
s = "";
|
||||
s += f.background_hpos.value + (isNum(f.background_hpos.value) ? f.background_hpos_measurement.value : "") + " ";
|
||||
s += f.background_vpos.value + (isNum(f.background_vpos.value) ? f.background_vpos_measurement.value : "");
|
||||
ce.style.backgroundPosition = s;
|
||||
}
|
||||
|
||||
// Build block styles
|
||||
|
||||
ce.style.wordSpacing = f.block_wordspacing.value + (isNum(f.block_wordspacing.value) ? f.block_wordspacing_measurement.value : "");
|
||||
ce.style.letterSpacing = f.block_letterspacing.value + (isNum(f.block_letterspacing.value) ? f.block_letterspacing_measurement.value : "");
|
||||
ce.style.verticalAlign = f.block_vertical_alignment.value;
|
||||
ce.style.textAlign = f.block_text_align.value;
|
||||
ce.style.textIndent = f.block_text_indent.value + (isNum(f.block_text_indent.value) ? f.block_text_indent_measurement.value : "");
|
||||
ce.style.whiteSpace = f.block_whitespace.value;
|
||||
ce.style.display = f.block_display.value;
|
||||
|
||||
// Build box styles
|
||||
|
||||
ce.style.width = f.box_width.value + (isNum(f.box_width.value) ? f.box_width_measurement.value : "");
|
||||
ce.style.height = f.box_height.value + (isNum(f.box_height.value) ? f.box_height_measurement.value : "");
|
||||
ce.style.styleFloat = f.box_float.value;
|
||||
ce.style.cssFloat = f.box_float.value;
|
||||
|
||||
ce.style.clear = f.box_clear.value;
|
||||
|
||||
if (!f.box_padding_same.checked) {
|
||||
ce.style.paddingTop = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : "");
|
||||
ce.style.paddingRight = f.box_padding_right.value + (isNum(f.box_padding_right.value) ? f.box_padding_right_measurement.value : "");
|
||||
ce.style.paddingBottom = f.box_padding_bottom.value + (isNum(f.box_padding_bottom.value) ? f.box_padding_bottom_measurement.value : "");
|
||||
ce.style.paddingLeft = f.box_padding_left.value + (isNum(f.box_padding_left.value) ? f.box_padding_left_measurement.value : "");
|
||||
} else
|
||||
ce.style.padding = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : "");
|
||||
|
||||
if (!f.box_margin_same.checked) {
|
||||
ce.style.marginTop = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : "");
|
||||
ce.style.marginRight = f.box_margin_right.value + (isNum(f.box_margin_right.value) ? f.box_margin_right_measurement.value : "");
|
||||
ce.style.marginBottom = f.box_margin_bottom.value + (isNum(f.box_margin_bottom.value) ? f.box_margin_bottom_measurement.value : "");
|
||||
ce.style.marginLeft = f.box_margin_left.value + (isNum(f.box_margin_left.value) ? f.box_margin_left_measurement.value : "");
|
||||
} else
|
||||
ce.style.margin = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : "");
|
||||
|
||||
// Build border styles
|
||||
|
||||
if (!f.border_style_same.checked) {
|
||||
ce.style.borderTopStyle = f.border_style_top.value;
|
||||
ce.style.borderRightStyle = f.border_style_right.value;
|
||||
ce.style.borderBottomStyle = f.border_style_bottom.value;
|
||||
ce.style.borderLeftStyle = f.border_style_left.value;
|
||||
} else
|
||||
ce.style.borderStyle = f.border_style_top.value;
|
||||
|
||||
if (!f.border_width_same.checked) {
|
||||
ce.style.borderTopWidth = f.border_width_top.value + (isNum(f.border_width_top.value) ? f.border_width_top_measurement.value : "");
|
||||
ce.style.borderRightWidth = f.border_width_right.value + (isNum(f.border_width_right.value) ? f.border_width_right_measurement.value : "");
|
||||
ce.style.borderBottomWidth = f.border_width_bottom.value + (isNum(f.border_width_bottom.value) ? f.border_width_bottom_measurement.value : "");
|
||||
ce.style.borderLeftWidth = f.border_width_left.value + (isNum(f.border_width_left.value) ? f.border_width_left_measurement.value : "");
|
||||
} else
|
||||
ce.style.borderWidth = f.border_width_top.value + (isNum(f.border_width_top.value) ? f.border_width_top_measurement.value : "");
|
||||
|
||||
if (!f.border_color_same.checked) {
|
||||
ce.style.borderTopColor = f.border_color_top.value;
|
||||
ce.style.borderRightColor = f.border_color_right.value;
|
||||
ce.style.borderBottomColor = f.border_color_bottom.value;
|
||||
ce.style.borderLeftColor = f.border_color_left.value;
|
||||
} else
|
||||
ce.style.borderColor = f.border_color_top.value;
|
||||
|
||||
// Build list styles
|
||||
|
||||
ce.style.listStyleType = f.list_type.value;
|
||||
ce.style.listStylePosition = f.list_position.value;
|
||||
ce.style.listStyleImage = f.list_bullet_image.value != "" ? "url(" + f.list_bullet_image.value + ")" : "";
|
||||
|
||||
// Build positioning styles
|
||||
|
||||
ce.style.position = f.positioning_type.value;
|
||||
ce.style.visibility = f.positioning_visibility.value;
|
||||
|
||||
if (ce.style.width == "")
|
||||
ce.style.width = f.positioning_width.value + (isNum(f.positioning_width.value) ? f.positioning_width_measurement.value : "");
|
||||
|
||||
if (ce.style.height == "")
|
||||
ce.style.height = f.positioning_height.value + (isNum(f.positioning_height.value) ? f.positioning_height_measurement.value : "");
|
||||
|
||||
ce.style.zIndex = f.positioning_zindex.value;
|
||||
ce.style.overflow = f.positioning_overflow.value;
|
||||
|
||||
if (!f.positioning_placement_same.checked) {
|
||||
ce.style.top = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : "");
|
||||
ce.style.right = f.positioning_placement_right.value + (isNum(f.positioning_placement_right.value) ? f.positioning_placement_right_measurement.value : "");
|
||||
ce.style.bottom = f.positioning_placement_bottom.value + (isNum(f.positioning_placement_bottom.value) ? f.positioning_placement_bottom_measurement.value : "");
|
||||
ce.style.left = f.positioning_placement_left.value + (isNum(f.positioning_placement_left.value) ? f.positioning_placement_left_measurement.value : "");
|
||||
} else {
|
||||
s = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : "");
|
||||
ce.style.top = s;
|
||||
ce.style.right = s;
|
||||
ce.style.bottom = s;
|
||||
ce.style.left = s;
|
||||
}
|
||||
|
||||
if (!f.positioning_clip_same.checked) {
|
||||
s = "rect(";
|
||||
s += (isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto") + " ";
|
||||
s += (isNum(f.positioning_clip_right.value) ? f.positioning_clip_right.value + f.positioning_clip_right_measurement.value : "auto") + " ";
|
||||
s += (isNum(f.positioning_clip_bottom.value) ? f.positioning_clip_bottom.value + f.positioning_clip_bottom_measurement.value : "auto") + " ";
|
||||
s += (isNum(f.positioning_clip_left.value) ? f.positioning_clip_left.value + f.positioning_clip_left_measurement.value : "auto");
|
||||
s += ")";
|
||||
|
||||
if (s != "rect(auto auto auto auto)")
|
||||
ce.style.clip = s;
|
||||
} else {
|
||||
s = "rect(";
|
||||
t = isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto";
|
||||
s += t + " ";
|
||||
s += t + " ";
|
||||
s += t + " ";
|
||||
s += t + ")";
|
||||
|
||||
if (s != "rect(auto auto auto auto)")
|
||||
ce.style.clip = s;
|
||||
}
|
||||
|
||||
ce.style.cssText = ce.style.cssText;
|
||||
}
|
||||
|
||||
function isNum(s) {
|
||||
return new RegExp('[0-9]+', 'g').test(s);
|
||||
}
|
||||
|
||||
function showDisabledControls() {
|
||||
var f = document.forms, i, a;
|
||||
|
||||
for (i=0; i<f.length; i++) {
|
||||
for (a=0; a<f[i].elements.length; a++) {
|
||||
if (f[i].elements[a].disabled)
|
||||
tinyMCEPopup.editor.dom.addClass(f[i].elements[a], "disabled");
|
||||
else
|
||||
tinyMCEPopup.editor.dom.removeClass(f[i].elements[a], "disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fillSelect(f, s, param, dval, sep, em) {
|
||||
var i, ar, p, se;
|
||||
|
||||
f = document.forms[f];
|
||||
sep = typeof(sep) == "undefined" ? ";" : sep;
|
||||
|
||||
if (em)
|
||||
addSelectValue(f, s, "", "");
|
||||
|
||||
ar = tinyMCEPopup.getParam(param, dval).split(sep);
|
||||
for (i=0; i<ar.length; i++) {
|
||||
se = false;
|
||||
|
||||
if (ar[i].charAt(0) == '+') {
|
||||
ar[i] = ar[i].substring(1);
|
||||
se = true;
|
||||
}
|
||||
|
||||
p = ar[i].split('=');
|
||||
|
||||
if (p.length > 1) {
|
||||
addSelectValue(f, s, p[0], p[1]);
|
||||
|
||||
if (se)
|
||||
selectByValue(f, s, p[1]);
|
||||
} else {
|
||||
addSelectValue(f, s, p[0], p[0]);
|
||||
|
||||
if (se)
|
||||
selectByValue(f, s, p[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toggleSame(ce, pre) {
|
||||
var el = document.forms[0].elements, i;
|
||||
|
||||
if (ce.checked) {
|
||||
el[pre + "_top"].disabled = false;
|
||||
el[pre + "_right"].disabled = true;
|
||||
el[pre + "_bottom"].disabled = true;
|
||||
el[pre + "_left"].disabled = true;
|
||||
|
||||
if (el[pre + "_top_measurement"]) {
|
||||
el[pre + "_top_measurement"].disabled = false;
|
||||
el[pre + "_right_measurement"].disabled = true;
|
||||
el[pre + "_bottom_measurement"].disabled = true;
|
||||
el[pre + "_left_measurement"].disabled = true;
|
||||
}
|
||||
} else {
|
||||
el[pre + "_top"].disabled = false;
|
||||
el[pre + "_right"].disabled = false;
|
||||
el[pre + "_bottom"].disabled = false;
|
||||
el[pre + "_left"].disabled = false;
|
||||
|
||||
if (el[pre + "_top_measurement"]) {
|
||||
el[pre + "_top_measurement"].disabled = false;
|
||||
el[pre + "_right_measurement"].disabled = false;
|
||||
el[pre + "_bottom_measurement"].disabled = false;
|
||||
el[pre + "_left_measurement"].disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
showDisabledControls();
|
||||
}
|
||||
|
||||
function synch(fr, to) {
|
||||
var f = document.forms[0];
|
||||
|
||||
f.elements[to].value = f.elements[fr].value;
|
||||
|
||||
if (f.elements[fr + "_measurement"])
|
||||
selectByValue(f, to + "_measurement", f.elements[fr + "_measurement"].value);
|
||||
}
|
||||
|
||||
function updateTextDecorations(){
|
||||
var el = document.forms[0].elements;
|
||||
|
||||
var textDecorations = ["text_underline", "text_overline", "text_linethrough", "text_blink"];
|
||||
var noneChecked = el["text_none"].checked;
|
||||
tinymce.each(textDecorations, function(id) {
|
||||
el[id].disabled = noneChecked;
|
||||
if (noneChecked) {
|
||||
el[id].checked = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
tinyMCEPopup.onInit.add(init);
|
@ -1 +0,0 @@
|
||||
tinyMCE.addI18n('en.style_dlg',{"text_lineheight":"Line Height","text_variant":"Variant","text_style":"Style","text_weight":"Weight","text_size":"Size","text_font":"Font","text_props":"Text","positioning_tab":"Positioning","list_tab":"List","border_tab":"Border","box_tab":"Box","block_tab":"Block","background_tab":"Background","text_tab":"Text",apply:"Apply",toggle_insert_span:"Insert span at selection",title:"Edit CSS Style",clip:"Clip",placement:"Placement",overflow:"Overflow",zindex:"Z-index",visibility:"Visibility","positioning_type":"Type",position:"Position","bullet_image":"Bullet Image","list_type":"Type",color:"Color",height:"Height",width:"Width",style:"Style",margin:"Margin",left:"Left",bottom:"Bottom",right:"Right",top:"Top",same:"Same for All",padding:"Padding","box_clear":"Clear","box_float":"Float","box_height":"Height","box_width":"Width","block_display":"Display","block_whitespace":"Whitespace","block_text_indent":"Text Indent","block_text_align":"Text Align","block_vertical_alignment":"Vertical Alignment","block_letterspacing":"Letter Spacing","block_wordspacing":"Word Spacing","background_vpos":"Vertical Position","background_hpos":"Horizontal Position","background_attachment":"Attachment","background_repeat":"Repeat","background_image":"Background Image","background_color":"Background Color","text_none":"None","text_blink":"Blink","text_case":"Case","text_striketrough":"Strikethrough","text_underline":"Underline","text_overline":"Overline","text_decoration":"Decoration","text_color":"Color",text:"Text",background:"Background",block:"Block",box:"Box",border:"Border",list:"List"});
|
Laden…
Verwijs in nieuw issue
Block a user