Run TinyMCE as content rather than chrome (and now without needing any modifications)

Also upgraded to latest version

Popup windows currently show location and status bars, which needs to be fixed
This commit is contained in:
Dan Stillman 2010-10-09 08:04:25 +00:00
parent 938ed9d04e
commit 84f59ab451
29 changed files with 5997 additions and 5778 deletions

View File

@ -30,3 +30,6 @@ td.mceIframeContainer {
width: 100% !important;
}
#tinymce_formatselect_text {
width: 65px;
}

View File

@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TinyMCE</title>
<link type="text/css" rel="stylesheet" href="chrome://zotero/skin/tinymce/note-ui.css"/>
<link type="text/css" rel="stylesheet" href="css/note-ui.css"/>
<script type="text/javascript" src="tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
@ -10,7 +10,7 @@
body_id : "zotero-tinymce-note",
mode : "none",
theme : "advanced",
content_css : "chrome://zotero/skin/tinymce/note-content.css",
content_css : "css/note-content.css",
button_tile_map : true,
language : "en", // TODO: localize
entity_encoding : "raw",

View File

@ -1,31 +1,74 @@
/**
* $Id: editor_plugin_src.js 848 2008-05-15 11:54:40Z spocke $
* editor_plugin_src.js
*
* @author Moxiecode
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* Contains modifications by Zotero (commented)
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
var Event = tinymce.dom.Event, each = tinymce.each, DOM = tinymce.DOM;
/**
* This plugin a context menu to TinyMCE editor instances.
*
* @class tinymce.plugins.ContextMenu
*/
tinymce.create('tinymce.plugins.ContextMenu', {
/**
* 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.
*
* @method init
* @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) {
var t = this;
var t = this, lastRng;
t.editor = ed;
/**
* This event gets fired when the context menu is shown.
*
* @event onContextMenu
* @param {tinymce.plugins.ContextMenu} sender Plugin instance sending the event.
* @param {tinymce.ui.DropMenu} menu Drop down menu to fill with more items if needed.
*/
t.onContextMenu = new tinymce.util.Dispatcher(this);
ed.onContextMenu.add(function(ed, e) {
if (!e.ctrlKey) {
// Restore the last selection since it was removed
if (lastRng)
ed.selection.setRng(lastRng);
t._getMenu(ed).showMenu(e.clientX, e.clientY);
Event.add(ed.getDoc(), 'click', hide);
Event.add(ed.getDoc(), 'click', function(e) {
hide(ed, e);
});
Event.cancel(e);
}
});
function hide() {
ed.onRemove.add(function() {
if (t._menu)
t._menu.removeAll();
});
function hide(ed, e) {
lastRng = null;
// Since the contextmenu event moves
// the selection we need to store it away
if (e && e.button == 2) {
lastRng = ed.selection.getRng();
return;
}
if (t._menu) {
t._menu.removeAll();
t._menu.destroy();
@ -37,6 +80,13 @@
ed.onKeyDown.add(hide);
},
/**
* Returns information about the plugin as a name/value array.
* The current keys are longname, author, authorurl, infourl and version.
*
* @method getInfo
* @return {Object} Name/value array containing information about the plugin.
*/
getInfo : function() {
return {
longname : 'Contextmenu',
@ -76,9 +126,8 @@
m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
}
// Disabled by Dan S./Zotero
//m.addSeparator();
//m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
m.addSeparator();
m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
m.addSeparator();
am = m.addMenu({title : 'contextmenu.align'});
@ -95,4 +144,4 @@
// Register plugin
tinymce.PluginManager.add('contextmenu', tinymce.plugins.ContextMenu);
})();
})();

View File

@ -1,16 +1,46 @@
/**
* $Id: editor_plugin_src.js 1143 2009-05-27 10:05:31Z spocke $
* editor_plugin_src.js
*
* @author Moxiecode
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
var each = tinymce.each;
var each = tinymce.each,
entities = null,
defs = {
paste_auto_cleanup_on_paste : true,
paste_block_drop : false,
paste_retain_style_properties : "none",
paste_strip_class_attributes : "mso",
paste_remove_spans : false,
paste_remove_styles : false,
paste_remove_styles_if_webkit : true,
paste_convert_middot_lists : true,
paste_convert_headers_to_strong : false,
paste_dialog_width : "450",
paste_dialog_height : "400",
paste_text_use_dialog : false,
paste_text_sticky : false,
paste_text_notifyalways : false,
paste_text_linebreaktype : "p",
paste_text_replacements : [
[/\u2026/g, "..."],
[/[\x93\x94\u201c\u201d]/g, '"'],
[/[\x60\x91\x92\u2018\u2019]/g, "'"]
]
};
function getParam(ed, name) {
return ed.getParam(name, defs[name]);
}
tinymce.create('tinymce.plugins.PastePlugin', {
init : function(ed, url) {
var t = this, cb;
var t = this;
t.editor = ed;
t.url = url;
@ -33,8 +63,12 @@
ed.execCallback('paste_postprocess', pl, o);
});
// Initialize plain text flag
ed.pasteAsPlainText = false;
// This function executes the process handlers and inserts the contents
function process(o) {
// force_rich overrides plain text mode set by user, important for pasting with execCommand
function process(o, force_rich) {
var dom = ed.dom;
// Execute pre process handlers
@ -49,29 +83,69 @@
// Serialize content
o.content = ed.serializer.serialize(o.node, {getInner : 1});
// Insert cleaned content. We need to handle insertion of contents containing block elements separately
if (/<(p|h[1-6]|ul|ol)/.test(o.content))
// Plain text option active?
if ((!force_rich) && (ed.pasteAsPlainText)) {
t._insertPlainText(ed, dom, o.content);
if (!getParam(ed, "paste_text_sticky")) {
ed.pasteAsPlainText = false;
ed.controlManager.setActive("pastetext", false);
}
} else if (/<(p|h[1-6]|ul|ol)/.test(o.content)) {
// Handle insertion of contents containing block elements separately
t._insertBlockContent(ed, dom, o.content);
else
} else {
t._insert(o.content);
};
}
}
// Add command for external usage
ed.addCommand('mceInsertClipboardContent', function(u, o) {
process(o);
process(o, true);
});
if (!getParam(ed, "paste_text_use_dialog")) {
ed.addCommand('mcePasteText', function(u, v) {
var cookie = tinymce.util.Cookie;
ed.pasteAsPlainText = !ed.pasteAsPlainText;
ed.controlManager.setActive('pastetext', ed.pasteAsPlainText);
if ((ed.pasteAsPlainText) && (!cookie.get("tinymcePasteText"))) {
if (getParam(ed, "paste_text_sticky")) {
ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));
} else {
ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));
}
if (!getParam(ed, "paste_text_notifyalways")) {
cookie.set("tinymcePasteText", "1", new Date(new Date().getFullYear() + 1, 12, 31))
}
}
});
}
ed.addButton('pastetext', {title: 'paste.paste_text_desc', cmd: 'mcePasteText'});
ed.addButton('selectall', {title: 'paste.selectall_desc', cmd: 'selectall'});
// This function grabs the contents from the clipboard by adding a
// hidden div and placing the caret inside it and after the browser paste
// is done it grabs that contents and processes that
function grabContent(e) {
var n, or, rng, sel = ed.selection, dom = ed.dom, body = ed.getBody(), posY;
// Check if browser supports direct plaintext access
if (ed.pasteAsPlainText && (e.clipboardData || dom.doc.dataTransfer)) {
e.preventDefault();
process({content : (e.clipboardData || dom.doc.dataTransfer).getData('Text')}, true);
return;
}
if (dom.get('_mcePaste'))
return;
// Create container to paste into
n = dom.add(body, 'div', {id : '_mcePaste'}, '&nbsp;');
n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste'}, '\uFEFF<br _mce_bogus="1">');
// If contentEditable mode we need to find out the position of the closest element
if (body != ed.getDoc().body)
@ -98,11 +172,28 @@
// Remove container
dom.remove(n);
// Check if the contents was changed, if it wasn't then clipboard extraction failed probably due
// to IE security settings so we pass the junk though better than nothing right
if (n.innerHTML === '\uFEFF') {
ed.execCommand('mcePasteWord');
e.preventDefault();
return;
}
// Process contents
process({content : n.innerHTML});
// Block the real paste event
return tinymce.dom.Event.cancel(e);
} else {
function block(e) {
e.preventDefault();
};
// Block mousedown and click to prevent selection change
dom.bind(ed.getDoc(), 'mousedown', block);
dom.bind(ed.getDoc(), 'keydown', block);
or = ed.selection.getRng();
// Move caret into hidden div
@ -114,32 +205,55 @@
// Wait a while and grab the pasted contents
window.setTimeout(function() {
var n = dom.get('_mcePaste'), h;
var h = '', nl = dom.select('div.mcePaste');
// Webkit clones the _mcePaste div for some odd reason so this will ensure that we get the real new div not the old empty one
n.id = '_mceRemoved';
dom.remove(n);
n = dom.get('_mcePaste') || n;
// WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string
each(nl, function(n) {
var child = n.firstChild;
// Grab the HTML contents
// We need to look for a apple style wrapper on webkit it also adds a div wrapper if you copy/paste the body of the editor
// It's amazing how strange the contentEditable mode works in WebKit
h = (dom.select('> span.Apple-style-span div', n)[0] || dom.select('> span.Apple-style-span', n)[0] || n).innerHTML;
// WebKit inserts a DIV container with lots of odd styles
if (child && child.nodeName == 'DIV' && child.style.marginTop && child.style.backgroundColor) {
dom.remove(child, 1);
}
// Remove hidden div and restore selection
dom.remove(n);
// WebKit duplicates the divs so we need to remove them
each(dom.select('div.mcePaste', n), function(n) {
dom.remove(n, 1);
});
// Remove apply style spans
each(dom.select('span.Apple-style-span', n), function(n) {
dom.remove(n, 1);
});
// Remove bogus br elements
each(dom.select('br[_mce_bogus]', n), function(n) {
dom.remove(n);
});
h += n.innerHTML;
});
// Remove the nodes
each(nl, function(n) {
dom.remove(n);
});
// Restore the old selection
if (or)
sel.setRng(or);
process({content : h});
// Unblock events ones we got the contents
dom.unbind(ed.getDoc(), 'mousedown', block);
dom.unbind(ed.getDoc(), 'keydown', block);
}, 0);
}
};
}
// Check if we should use the new auto process method
if (ed.getParam('paste_auto_cleanup_on_paste', true)) {
if (getParam(ed, "paste_auto_cleanup_on_paste")) {
// Is it's Opera or older FF use key handler
if (tinymce.isOpera || /Firefox\/2/.test(navigator.userAgent)) {
ed.onKeyDown.add(function(ed, e) {
@ -155,7 +269,7 @@
}
// Block all drag/drop events
if (ed.getParam('paste_block_drop')) {
if (getParam(ed, "paste_block_drop")) {
ed.onInit.add(function() {
ed.dom.bind(ed.getBody(), ['dragend', 'dragover', 'draggesture', 'dragdrop', 'drop', 'drag'], function(e) {
e.preventDefault();
@ -181,10 +295,15 @@
},
_preProcess : function(pl, o) {
var ed = this.editor, h = o.content, process, stripClass;
//console.log('Before preprocess:' + o.content);
var ed = this.editor,
h = o.content,
grep = tinymce.grep,
explode = tinymce.explode,
trim = tinymce.trim,
len, stripClass;
function process(items) {
each(items, function(v) {
// Remove or replace
@ -193,69 +312,203 @@
else
h = h.replace(v[0], v[1]);
});
};
// Process away some basic content
process([
/^\s*(&nbsp;)+/g, // nbsp entities at the start of contents
/(&nbsp;|<br[^>]*>)+\s*$/g // nbsp entities at the end of contents
]);
}
// Detect Word content and process it more aggressive
if (/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(h) || o.wordContent) {
o.wordContent = true; // Mark the pasted contents as word specific content
if (/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(h) || o.wordContent) {
o.wordContent = true; // Mark the pasted contents as word specific content
//console.log('Word contents detected.');
if (ed.getParam('paste_convert_middot_lists', true)) {
// Process away some basic content
process([
/^\s*(&nbsp;)+/gi, // &nbsp; entities at the start of contents
/(&nbsp;|<br[^>]*>)+\s*$/gi // &nbsp; entities at the end of contents
]);
if (getParam(ed, "paste_convert_headers_to_strong")) {
h = h.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi, "<p><strong>$1</strong></p>");
}
if (getParam(ed, "paste_convert_middot_lists")) {
process([
[/<!--\[if !supportLists\]-->/gi, '$&__MCE_ITEM__'], // Convert supportLists to a list item marker
[/(<span[^>]+:\s*symbol[^>]+>)/gi, '$1__MCE_ITEM__'], // Convert symbol spans to list items
[/(<span[^>]+mso-list:[^>]+>)/gi, '$1__MCE_ITEM__'] // Convert mso-list to item marker
[/<!--\[if !supportLists\]-->/gi, '$&__MCE_ITEM__'], // Convert supportLists to a list item marker
[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi, '$1__MCE_ITEM__'] // Convert mso-list and symbol spans to item markers
]);
}
process([
/<!--[\s\S]+?-->/gi, // Word comments
/<\/?(img|font|meta|link|style|div|v:\w+)[^>]*>/gi, // Remove some tags including VML content
/<\\?\?xml[^>]*>/gi, // XML namespace declarations
/<\/?o:[^>]*>/gi, // MS namespaced elements <o:tag>
/ (id|name|language|type|on\w+|v:\w+)=\"([^\"]*)\"/gi, // on.., class, style and language attributes with quotes
/ (id|name|language|type|on\w+|v:\w+)=(\w+)/gi, // on.., class, style and language attributes without quotes (IE)
[/<(\/?)s>/gi, '<$1strike>'], // Convert <s> into <strike> for line-though
/<script[^>]+>[\s\S]*?<\/script>/gi, // All scripts elements for msoShowComment for example
[/&nbsp;/g, '\u00a0'] // Replace nsbp entites to char since it's easier to handle
// Word comments like conditional comments etc
/<!--[\s\S]+?-->/gi,
// Remove comments, scripts (e.g., msoShowComment), XML tag, VML content, MS Office namespaced tags, and a few other tags
/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
// Convert <s> into <strike> for line-though
[/<(\/?)s>/gi, "<$1strike>"],
// Replace nsbp entites to char since it's easier to handle
[/&nbsp;/gi, "\u00a0"]
]);
// Remove bad attributes, with or without quotes, ensuring that attribute text is really inside a tag.
// If JavaScript had a RegExp look-behind, we could have integrated this with the last process() array and got rid of the loop. But alas, it does not, so we cannot.
do {
len = h.length;
h = h.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1");
} while (len != h.length);
// Remove all spans if no styles is to be retained
if (!ed.getParam('paste_retain_style_properties')) {
if (getParam(ed, "paste_retain_style_properties").replace(/^none$/i, "").length == 0) {
h = h.replace(/<\/?span[^>]*>/gi, "");
} else {
// We're keeping styles, so at least clean them up.
// CSS Reference: http://msdn.microsoft.com/en-us/library/aa155477.aspx
process([
/<\/?(span)[^>]*>/gi
// Convert <span style="mso-spacerun:yes">___</span> to string of alternating breaking/non-breaking spaces of same length
[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
function(str, spaces) {
return (spaces.length > 0)? spaces.replace(/./, " ").slice(Math.floor(spaces.length/2)).split("").join("\u00a0") : "";
}
],
// Examine all styles: delete junk, transform some, and keep the rest
[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,
function(str, tag, style) {
var n = [],
i = 0,
s = explode(trim(style).replace(/&quot;/gi, "'"), ";");
// Examine each style definition within the tag's style attribute
each(s, function(v) {
var name, value,
parts = explode(v, ":");
function ensureUnits(v) {
return v + ((v !== "0") && (/\d$/.test(v)))? "px" : "";
}
if (parts.length == 2) {
name = parts[0].toLowerCase();
value = parts[1].toLowerCase();
// Translate certain MS Office styles into their CSS equivalents
switch (name) {
case "mso-padding-alt":
case "mso-padding-top-alt":
case "mso-padding-right-alt":
case "mso-padding-bottom-alt":
case "mso-padding-left-alt":
case "mso-margin-alt":
case "mso-margin-top-alt":
case "mso-margin-right-alt":
case "mso-margin-bottom-alt":
case "mso-margin-left-alt":
case "mso-table-layout-alt":
case "mso-height":
case "mso-width":
case "mso-vertical-align-alt":
n[i++] = name.replace(/^mso-|-alt$/g, "") + ":" + ensureUnits(value);
return;
case "horiz-align":
n[i++] = "text-align:" + value;
return;
case "vert-align":
n[i++] = "vertical-align:" + value;
return;
case "font-color":
case "mso-foreground":
n[i++] = "color:" + value;
return;
case "mso-background":
case "mso-highlight":
n[i++] = "background:" + value;
return;
case "mso-default-height":
n[i++] = "min-height:" + ensureUnits(value);
return;
case "mso-default-width":
n[i++] = "min-width:" + ensureUnits(value);
return;
case "mso-padding-between-alt":
n[i++] = "border-collapse:separate;border-spacing:" + ensureUnits(value);
return;
case "text-line-through":
if ((value == "single") || (value == "double")) {
n[i++] = "text-decoration:line-through";
}
return;
case "mso-zero-height":
if (value == "yes") {
n[i++] = "display:none";
}
return;
}
// Eliminate all MS Office style definitions that have no CSS equivalent by examining the first characters in the name
if (/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(name)) {
return;
}
// If it reached this point, it must be a valid CSS style
n[i++] = name + ":" + parts[1]; // Lower-case name, but keep value case
}
});
// If style attribute contained any valid styles the re-write it; otherwise delete style attribute.
if (i > 0) {
return tag + ' style="' + n.join(';') + '"';
} else {
return tag;
}
}
]
]);
}
}
// Allow for class names to be retained if desired; either all, or just the ones from Word
// Note that the paste_strip_class_attributes: 'none, verify_css_classes: true is also a good variation.
stripClass = ed.getParam('paste_strip_class_attributes', 'all');
if (stripClass != 'none') {
if (stripClass == 'all') {
process([
/ class=\"([^\"]*)\"/gi, // class attributes with quotes
/ class=(\w+)/gi // class attributes without quotes (IE)
]);
} else { // Only strip the 'mso*' classes
process([
/ class=\"(mso[^\"]*)\"/gi, // class attributes with quotes
/ class=(mso\w+)/gi // class attributes without quotes (IE)
]);
}
// Replace headers with <strong>
if (getParam(ed, "paste_convert_headers_to_strong")) {
process([
[/<h[1-6][^>]*>/gi, "<p><strong>"],
[/<\/h[1-6][^>]*>/gi, "</strong></p>"]
]);
}
// Class attribute options are: leave all as-is ("none"), remove all ("all"), or remove only those starting with mso ("mso").
// Note:- paste_strip_class_attributes: "none", verify_css_classes: true is also a good variation.
stripClass = getParam(ed, "paste_strip_class_attributes");
if (stripClass !== "none") {
function removeClasses(match, g1) {
if (stripClass === "all")
return '';
var cls = grep(explode(g1.replace(/^(["'])(.*)\1$/, "$2"), " "),
function(v) {
return (/^(?!mso)/i.test(v));
}
);
return cls.length ? ' class="' + cls.join(" ") + '"' : '';
};
h = h.replace(/ class="([^"]+)"/gi, removeClasses);
h = h.replace(/ class=(\w+)/gi, removeClasses);
}
// Remove spans option
if (ed.getParam('paste_remove_spans')) {
process([
/<\/?(span)[^>]*>/gi
]);
if (getParam(ed, "paste_remove_spans")) {
h = h.replace(/<\/?span[^>]*>/gi, "");
}
//console.log('After preprocess:' + h);
@ -276,56 +529,58 @@
dom.remove(a, 1);
});
if (t.editor.getParam('paste_convert_middot_lists', true))
if (getParam(ed, "paste_convert_middot_lists")) {
t._convertLists(pl, o);
}
// Process styles
styleProps = ed.getParam('paste_retain_style_properties'); // retained properties
styleProps = getParam(ed, "paste_retain_style_properties"); // retained properties
// If string property then split it
if (tinymce.is(styleProps, 'string'))
styleProps = tinymce.explode(styleProps);
// Process only if a string was specified and not equal to "all" or "*"
if ((tinymce.is(styleProps, "string")) && (styleProps !== "all") && (styleProps !== "*")) {
styleProps = tinymce.explode(styleProps.replace(/^none$/i, ""));
// Retains some style properties
each(dom.select('*', o.node), function(el) {
var newStyle = {}, npc = 0, i, sp, sv;
// Retains some style properties
each(dom.select('*', o.node), function(el) {
var newStyle = {}, npc = 0, i, sp, sv;
// Store a subset of the existing styles
if (styleProps) {
for (i = 0; i < styleProps.length; i++) {
sp = styleProps[i];
sv = dom.getStyle(el, sp);
// Store a subset of the existing styles
if (styleProps) {
for (i = 0; i < styleProps.length; i++) {
sp = styleProps[i];
sv = dom.getStyle(el, sp);
if (sv) {
newStyle[sp] = sv;
npc++;
if (sv) {
newStyle[sp] = sv;
npc++;
}
}
}
}
// Remove all of the existing styles
dom.setAttrib(el, 'style', '');
// Remove all of the existing styles
dom.setAttrib(el, 'style', '');
if (styleProps && npc > 0)
dom.setStyles(el, newStyle); // Add back the stored subset of styles
else // Remove empty span tags that do not have class attributes
if (el.nodeName == 'SPAN' && !el.className)
dom.remove(el, true);
});
if (styleProps && npc > 0)
dom.setStyles(el, newStyle); // Add back the stored subset of styles
else // Remove empty span tags that do not have class attributes
if (el.nodeName == 'SPAN' && !el.className)
dom.remove(el, true);
});
}
}
// Remove all style information or only specifically on WebKit to avoid the style bug on that browser
if (ed.getParam("paste_remove_styles") || (ed.getParam("paste_remove_styles_if_webkit") && tinymce.isWebKit)) {
if (getParam(ed, "paste_remove_styles") || (getParam(ed, "paste_remove_styles_if_webkit") && tinymce.isWebKit)) {
each(dom.select('*[style]', o.node), function(el) {
el.removeAttribute('style');
el.removeAttribute('mce_style');
el.removeAttribute('_mce_style');
});
} else {
if (tinymce.isWebKit) {
// We need to compress the styles on WebKit since if you paste <img border="0" /> it will become <img border="0" style="... lots of junk ..." />
// Removing the mce_style that contains the real value will force the Serializer engine to compress the styles
each(dom.select('*', o.node), function(el) {
el.removeAttribute('mce_style');
el.removeAttribute('_mce_style');
});
}
}
@ -417,7 +672,7 @@
* This logic can be improved so text nodes at the start/end remain in the start/end block elements
*/
_insertBlockContent : function(ed, dom, content) {
var parentBlock, marker, sel = ed.selection, last, elm, vp, y, elmHeight;
var parentBlock, marker, sel = ed.selection, last, elm, vp, y, elmHeight, markerId = 'mce_marker';
function select(n) {
var r;
@ -431,14 +686,15 @@
sel.select(n, 1);
sel.collapse(false);
}
};
}
// Insert a marker for the caret position
this._insert('<span id="_marker">&nbsp;</span>', 1);
marker = dom.get('_marker');
parentBlock = dom.getParent(marker, 'p,h1,h2,h3,h4,h5,h6,ul,ol');
this._insert('<span id="' + markerId + '"></span>', 1);
marker = dom.get(markerId);
parentBlock = dom.getParent(marker, 'p,h1,h2,h3,h4,h5,h6,ul,ol,th,td');
if (parentBlock) {
// If it's a parent block but not a table cell
if (parentBlock && !/TD|TH/.test(parentBlock.nodeName)) {
// Split parent block
marker = dom.split(parentBlock, marker);
@ -455,7 +711,9 @@
sel.collapse(0);
}
dom.remove('_marker'); // Remove marker if it's left
// Remove marker if it's left
while (elm = dom.get(markerId))
dom.remove(elm);
// Get element, position and height
elm = sel.getStart();
@ -472,41 +730,223 @@
* Inserts the specified contents at the caret position.
*/
_insert : function(h, skip_undo) {
var ed = this.editor;
var ed = this.editor, r = ed.selection.getRng();
// First delete the contents seems to work better on WebKit
if (!ed.selection.isCollapsed())
// First delete the contents seems to work better on WebKit when the selection spans multiple list items or multiple table cells.
if (!ed.selection.isCollapsed() && r.startContainer != r.endContainer)
ed.getDoc().execCommand('Delete', false, null);
// It's better to use the insertHTML method on Gecko since it will combine paragraphs correctly before inserting the contents
ed.execCommand(tinymce.isGecko ? 'insertHTML' : 'mceInsertContent', false, h, {skip_undo : skip_undo});
},
/**
* Instead of the old plain text method which tried to re-create a paste operation, the
* new approach adds a plain text mode toggle switch that changes the behavior of paste.
* This function is passed the same input that the regular paste plugin produces.
* It performs additional scrubbing and produces (and inserts) the plain text.
* This approach leverages all of the great existing functionality in the paste
* plugin, and requires minimal changes to add the new functionality.
* Speednet - June 2009
*/
_insertPlainText : function(ed, dom, h) {
var i, len, pos, rpos, node, breakElms, before, after,
w = ed.getWin(),
d = ed.getDoc(),
sel = ed.selection,
is = tinymce.is,
inArray = tinymce.inArray,
linebr = getParam(ed, "paste_text_linebreaktype"),
rl = getParam(ed, "paste_text_replacements");
function process(items) {
each(items, function(v) {
if (v.constructor == RegExp)
h = h.replace(v, "");
else
h = h.replace(v[0], v[1]);
});
};
if ((typeof(h) === "string") && (h.length > 0)) {
if (!entities)
entities = ("34,quot,38,amp,39,apos,60,lt,62,gt," + ed.serializer.settings.entities).split(",");
// If HTML content with line-breaking tags, then remove all cr/lf chars because only tags will break a line
if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(h)) {
process([
/[\n\r]+/g
]);
} else {
// Otherwise just get rid of carriage returns (only need linefeeds)
process([
/\r+/g
]);
}
process([
[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi, "\n\n"], // Block tags get a blank line after them
[/<br[^>]*>|<\/tr>/gi, "\n"], // Single linebreak for <br /> tags and table rows
[/<\/t[dh]>\s*<t[dh][^>]*>/gi, "\t"], // Table cells get tabs betweem them
/<[a-z!\/?][^>]*>/gi, // Delete all remaining tags
[/&nbsp;/gi, " "], // Convert non-break spaces to regular spaces (remember, *plain text*)
[
// HTML entity
/&(#\d+|[a-z0-9]{1,10});/gi,
// Replace with actual character
function(e, s) {
if (s.charAt(0) === "#") {
return String.fromCharCode(s.slice(1));
}
else {
return ((e = inArray(entities, s)) > 0)? String.fromCharCode(entities[e-1]) : " ";
}
}
],
[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"], // Cool little RegExp deletes whitespace around linebreak chars.
[/\n{3,}/g, "\n\n"], // Max. 2 consecutive linebreaks
/^\s+|\s+$/g // Trim the front & back
]);
h = dom.encode(h);
// Delete any highlighted text before pasting
if (!sel.isCollapsed()) {
d.execCommand("Delete", false, null);
}
// Perform default or custom replacements
if (is(rl, "array") || (is(rl, "array"))) {
process(rl);
}
else if (is(rl, "string")) {
process(new RegExp(rl, "gi"));
}
// Treat paragraphs as specified in the config
if (linebr == "none") {
process([
[/\n+/g, " "]
]);
}
else if (linebr == "br") {
process([
[/\n/g, "<br />"]
]);
}
else {
process([
/^\s+|\s+$/g,
[/\n\n/g, "</p><p>"],
[/\n/g, "<br />"]
]);
}
// This next piece of code handles the situation where we're pasting more than one paragraph of plain
// text, and we are pasting the content into the middle of a block node in the editor. The block
// node gets split at the selection point into "Para A" and "Para B" (for the purposes of explaining).
// The first paragraph of the pasted text is appended to "Para A", and the last paragraph of the
// pasted text is prepended to "Para B". Any other paragraphs of pasted text are placed between
// "Para A" and "Para B". This code solves a host of problems with the original plain text plugin and
// now handles styles correctly. (Pasting plain text into a styled paragraph is supposed to make the
// plain text take the same style as the existing paragraph.)
if ((pos = h.indexOf("</p><p>")) != -1) {
rpos = h.lastIndexOf("</p><p>");
node = sel.getNode();
breakElms = []; // Get list of elements to break
do {
if (node.nodeType == 1) {
// Don't break tables and break at body
if (node.nodeName == "TD" || node.nodeName == "BODY") {
break;
}
breakElms[breakElms.length] = node;
}
} while (node = node.parentNode);
// Are we in the middle of a block node?
if (breakElms.length > 0) {
before = h.substring(0, pos);
after = "";
for (i=0, len=breakElms.length; i<len; i++) {
before += "</" + breakElms[i].nodeName.toLowerCase() + ">";
after += "<" + breakElms[breakElms.length-i-1].nodeName.toLowerCase() + ">";
}
if (pos == rpos) {
h = before + after + h.substring(pos+7);
}
else {
h = before + h.substring(pos+4, rpos+4) + after + h.substring(rpos+7);
}
}
}
// Insert content at the caret, plus add a marker for repositioning the caret
ed.execCommand("mceInsertRawHTML", false, h + '<span id="_plain_text_marker">&nbsp;</span>');
// Reposition the caret to the marker, which was placed immediately after the inserted content.
// Needs to be done asynchronously (in window.setTimeout) or else it doesn't work in all browsers.
// The second part of the code scrolls the content up if the caret is positioned off-screen.
// This is only necessary for WebKit browsers, but it doesn't hurt to use for all.
window.setTimeout(function() {
var marker = dom.get('_plain_text_marker'),
elm, vp, y, elmHeight;
sel.select(marker, false);
d.execCommand("Delete", false, null);
marker = null;
// Get element, position and height
elm = sel.getStart();
vp = dom.getViewPort(w);
y = dom.getPos(elm).y;
elmHeight = elm.clientHeight;
// Is element within viewport if not then scroll it into view
if ((y < vp.y) || (y + elmHeight > vp.y + vp.h)) {
d.body.scrollTop = y < vp.y ? y : y - vp.h + 25;
}
}, 0);
}
},
/**
* This method will open the old style paste dialogs. Some users might want the old behavior but still use the new cleanup engine.
*/
_legacySupport : function() {
var t = this, ed = t.editor;
// Register commands for backwards compatibility
each(['mcePasteText', 'mcePasteWord'], function(cmd) {
ed.addCommand(cmd, function() {
ed.windowManager.open({
file : t.url + (cmd == 'mcePasteText' ? '/pastetext.htm' : '/pasteword.htm'),
width : parseInt(ed.getParam("paste_dialog_width", "450")),
height : parseInt(ed.getParam("paste_dialog_height", "400")),
inline : 1
});
// Register command(s) for backwards compatibility
ed.addCommand("mcePasteWord", function() {
ed.windowManager.open({
file: t.url + "/pasteword.htm",
width: parseInt(getParam(ed, "paste_dialog_width")),
height: parseInt(getParam(ed, "paste_dialog_height")),
inline: 1
});
});
// Register buttons for backwards compatibility
ed.addButton('pastetext', {title : 'paste.paste_text_desc', cmd : 'mcePasteText'});
ed.addButton('pasteword', {title : 'paste.paste_word_desc', cmd : 'mcePasteWord'});
ed.addButton('selectall', {title : 'paste.selectall_desc', cmd : 'selectall'});
if (getParam(ed, "paste_text_use_dialog")) {
ed.addCommand("mcePasteText", function() {
ed.windowManager.open({
file : t.url + "/pastetext.htm",
width: parseInt(getParam(ed, "paste_dialog_width")),
height: parseInt(getParam(ed, "paste_dialog_height")),
inline : 1
});
});
}
// Register button for backwards compatibility
ed.addButton("pasteword", {title : "paste.paste_word_desc", cmd : "mcePasteWord"});
}
});
// Register plugin
tinymce.PluginManager.add('paste', tinymce.plugins.PastePlugin);
})();
tinymce.PluginManager.add("paste", tinymce.plugins.PastePlugin);
})();

View File

@ -1,4 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{#advanced_dlg.about_title}</title>
@ -48,9 +48,7 @@
</div>
<div class="mceActionPanel">
<div style="float: right">
<input type="button" id="cancel" name="cancel" value="{#close}" onclick="tinyMCEPopup.close();" />
</div>
<input type="button" id="cancel" name="cancel" value="{#close}" onclick="tinyMCEPopup.close();" />
</div>
</body>
</html>

View File

@ -4,7 +4,6 @@
<title>{#advanced_dlg.anchor_title}</title>
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="js/anchor.js"></script>
<base target="_self" />
</head>
<body style="display: none">
<form onsubmit="AnchorDialog.update();return false;" action="#">
@ -13,19 +12,14 @@
<td colspan="2" class="title">{#advanced_dlg.anchor_title}</td>
</tr>
<tr>
<td nowrap="nowrap">{#advanced_dlg.anchor_name}:</td>
<td class="nowrap">{#advanced_dlg.anchor_name}:</td>
<td><input name="anchorName" type="text" class="mceFocus" id="anchorName" value="" style="width: 200px" /></td>
</tr>
</table>
<div class="mceActionPanel">
<div style="float: left">
<input type="submit" id="insert" name="insert" value="{#update}" />
</div>
<div style="float: right">
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
<input type="submit" id="insert" name="insert" value="{#update}" />
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>

View File

@ -1,11 +1,9 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{#advanced_dlg.charmap_title}</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="js/charmap.js"></script>
<base target="_self" />
</head>
<body id="charmap" style="display:none">
<table align="center" border="0" cellspacing="0" cellpadding="2">

View File

@ -5,7 +5,6 @@
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="../../utils/mctabs.js"></script>
<script type="text/javascript" src="js/color_picker.js"></script>
<base target="_self" />
</head>
<body id="colorpicker" style="display: none">
<form onsubmit="insertAction();return false" action="#">
@ -22,7 +21,7 @@
<fieldset>
<legend>{#advanced_dlg.colorpicker_picker_title}</legend>
<div id="picker">
<img id="colors" src="img/colorpicker.jpg" onclick="computeColor(event)" onmousedown="isMouseDown = true;return false;" onmouseup="isMouseDown = false;" onmousemove="if (isMouseDown && isMouseOver) computeColor(event); return false;" onmouseover="isMouseOver=true;" onmouseout="isMouseOver=false;" />
<img id="colors" src="img/colorpicker.jpg" onclick="computeColor(event)" onmousedown="isMouseDown = true;return false;" onmouseup="isMouseDown = false;" onmousemove="if (isMouseDown && isMouseOver) computeColor(event); return false;" onmouseover="isMouseOver=true;" onmouseout="isMouseOver=false;" alt="" />
<div id="light">
<!-- Will be filled with divs -->
@ -61,9 +60,7 @@
</div>
<div class="mceActionPanel">
<div style="float: left">
<input type="submit" id="insert" name="insert" value="{#apply}" />
</div>
<input type="submit" id="insert" name="insert" value="{#apply}" />
<div id="preview"></div>

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,6 @@
<script type="text/javascript" src="../../utils/mctabs.js"></script>
<script type="text/javascript" src="../../utils/form_utils.js"></script>
<script type="text/javascript" src="js/image.js"></script>
<base target="_self" />
</head>
<body id="image" style="display: none">
<form onsubmit="ImageDialog.update();return false;" action="#">
@ -20,7 +19,7 @@
<div id="general_panel" class="panel current">
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<td nowrap="nowrap"><label for="src">{#advanced_dlg.image_src}</label></td>
<td class="nowrap"><label for="src">{#advanced_dlg.image_src}</label></td>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input id="src" name="src" type="text" class="mceFocus" value="" style="width: 200px" onchange="ImageDialog.getImageData();" /></td>
@ -33,11 +32,11 @@
<td><select id="image_list" name="image_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;"></select></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="alt">{#advanced_dlg.image_alt}</label></td>
<td class="nowrap"><label for="alt">{#advanced_dlg.image_alt}</label></td>
<td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="align">{#advanced_dlg.image_align}</label></td>
<td class="nowrap"><label for="align">{#advanced_dlg.image_align}</label></td>
<td><select id="align" name="align" onchange="ImageDialog.updateStyle();">
<option value="">{#not_set}</option>
<option value="baseline">{#advanced_dlg.image_align_baseline}</option>
@ -51,21 +50,21 @@
</select></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="width">{#advanced_dlg.image_dimensions}</label></td>
<td class="nowrap"><label for="width">{#advanced_dlg.image_dimensions}</label></td>
<td><input id="width" name="width" type="text" value="" size="3" maxlength="5" />
x
<input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="border">{#advanced_dlg.image_border}</label></td>
<td class="nowrap"><label for="border">{#advanced_dlg.image_border}</label></td>
<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="vspace">{#advanced_dlg.image_vspace}</label></td>
<td class="nowrap"><label for="vspace">{#advanced_dlg.image_vspace}</label></td>
<td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="hspace">{#advanced_dlg.image_hspace}</label></td>
<td class="nowrap"><label for="hspace">{#advanced_dlg.image_hspace}</label></td>
<td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
</tr>
</table>
@ -73,13 +72,8 @@
</div>
<div class="mceActionPanel">
<div style="float: left">
<input type="submit" id="insert" name="insert" value="{#insert}" />
</div>
<div style="float: right">
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
<input type="submit" id="insert" name="insert" value="{#insert}" />
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -5,7 +5,7 @@ var AnchorDialog = {
var action, elm, f = document.forms[0];
this.editor = ed;
elm = ed.dom.getParent(ed.selection.getNode(), 'A,IMG');
elm = ed.dom.getParent(ed.selection.getNode(), 'A');
v = ed.dom.getAttrib(elm, 'name');
if (v) {
@ -17,18 +17,18 @@ var AnchorDialog = {
},
update : function() {
var ed = this.editor;
var ed = this.editor, elm, name = document.forms[0].anchorName.value;
tinyMCEPopup.restoreSelection();
if (this.action != 'update')
ed.selection.collapse(1);
// Webkit acts weird if empty inline element is inserted so we need to use a image instead
if (tinymce.isWebKit)
ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('img', {mce_name : 'a', name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}));
elm = ed.dom.getParent(ed.selection.getNode(), 'A');
if (elm)
elm.name = name;
else
ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}, ''));
ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : name, 'class' : 'mceItemAnchor'}, ''));
tinyMCEPopup.close();
}

View File

@ -1,3 +1,13 @@
/**
* charmap.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
tinyMCEPopup.requireLangPack();
var charmap = [

View File

@ -151,8 +151,8 @@ var ImageDialog = {
}
// Merge
st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st));
this.styleVal = dom.serializeStyle(st);
st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st), 'img');
this.styleVal = dom.serializeStyle(st, 'img');
}
},

View File

@ -53,6 +53,7 @@ var LinkDialog = {
// Create new anchor elements
if (e == null) {
ed.getDoc().execCommand("unlink", false, null);
tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
tinymce.each(ed.dom.select("a"), function(n) {
@ -62,8 +63,8 @@ var LinkDialog = {
ed.dom.setAttribs(e, {
href : f.href.value,
title : f.linktitle.value,
target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null,
'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null
target : f.target_list ? getSelectValue(f, "target_list") : null,
'class' : f.class_list ? getSelectValue(f, "class_list") : null
});
}
});
@ -71,8 +72,8 @@ var LinkDialog = {
ed.dom.setAttribs(e, {
href : f.href.value,
title : f.linktitle.value,
target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null,
'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null
target : f.target_list ? getSelectValue(f, "target_list") : null,
'class' : f.class_list ? getSelectValue(f, "class_list") : null
});
}
@ -92,7 +93,7 @@ var LinkDialog = {
if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email')))
n.value = 'mailto:' + n.value;
if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external')))
if (/^\s*www\./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external')))
n.value = 'http://' + n.value;
},

View File

@ -2,7 +2,7 @@ tinyMCEPopup.requireLangPack();
tinyMCEPopup.onInit.add(onLoadInit);
function saveContent() {
tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value);
tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value, {source_view : true});
tinyMCEPopup.close();
}
@ -13,7 +13,7 @@ function onLoadInit() {
if (tinymce.isGecko)
document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck");
document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent();
document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true});
if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) {
setWrap('soft');
@ -44,19 +44,13 @@ function toggleWordWrap(elm) {
setWrap('off');
}
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
function resizeInputs() {
var el = document.getElementById('htmlSource');
var vp = tinyMCEPopup.dom.getViewPort(window), el;
if (!tinymce.isIE) {
wHeight = self.innerHeight - 65;
wWidth = self.innerWidth - 16;
} else {
wHeight = document.body.clientHeight - 70;
wWidth = document.body.clientWidth - 16;
el = document.getElementById('htmlSource');
if (el) {
el.style.width = (vp.w - 20) + 'px';
el.style.height = (vp.h - 65) + 'px';
}
el.style.height = Math.abs(wHeight) + 'px';
el.style.width = Math.abs(wWidth) + 'px';
}

View File

@ -7,7 +7,6 @@
<script type="text/javascript" src="../../utils/form_utils.js"></script>
<script type="text/javascript" src="../../utils/validate.js"></script>
<script type="text/javascript" src="js/link.js"></script>
<base target="_self" />
</head>
<body id="link" style="display: none">
<form onsubmit="LinkDialog.update();return false;" action="#">
@ -22,7 +21,7 @@
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<td nowrap="nowrap"><label for="href">{#advanced_dlg.link_url}</label></td>
<td class="nowrap"><label for="href">{#advanced_dlg.link_url}</label></td>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input id="href" name="href" type="text" class="mceFocus" value="" style="width: 200px" onchange="LinkDialog.checkPrefix(this);" /></td>
@ -39,7 +38,7 @@
<td><select id="target_list" name="target_list"></select></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="linktitle">{#advanced_dlg.link_titlefield}</label></td>
<td class="nowrap"><label for="linktitle">{#advanced_dlg.link_titlefield}</label></td>
<td><input id="linktitle" name="linktitle" type="text" value="" style="width: 200px" /></td>
</tr>
<tr>
@ -51,13 +50,8 @@
</div>
<div class="mceActionPanel">
<div style="float: left">
<input type="submit" id="insert" name="insert" value="{#insert}" />
</div>
<div style="float: right">
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
<input type="submit" id="insert" name="insert" value="{#insert}" />
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>

View File

@ -8,8 +8,9 @@ h4 {font-size: 1em}
h5 {font-size: .83em}
h6 {font-size: .75em}
.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}
a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(img/items.gif) no-repeat bottom left;}
img.mceItemAnchor {width:12px; height:12px; background:url(img/items.gif) no-repeat;}
a.mceItemAnchor {display:inline-block; width:11px !important; height:11px !important; background:url(img/items.gif) no-repeat 0 0;}
span.mceItemNbsp {background: #DDD}
td.mceSelected, th.mceSelected {background-color:#3399ff !important}
img {border:0;}
table {cursor:default}
table td, table th {cursor:text}
@ -17,7 +18,7 @@ ins {border-bottom:1px solid green; text-decoration: none; color:green}
del {color:red; text-decoration:line-through}
cite {border-bottom:1px dashed blue}
acronym {border-bottom:1px dotted #CCC; cursor:help}
abbr, html\:abbr {border-bottom:1px dashed #CCC; cursor:help}
abbr {border-bottom:1px dashed #CCC; cursor:help}
/* IE */
* html body {
@ -30,3 +31,6 @@ scrollbar-highlight-color:#F0F0EE;
scrollbar-shadow-color:#F0F0EE;
scrollbar-track-color:#F5F5F5;
}
img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px}
font[face=mceinline] {font-family:inherit !important}

View File

@ -19,6 +19,7 @@ td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
textarea {resize:none;outline:none;}
a:link, a:visited {color:black;}
a:hover {color:#2B6FB6;}
.nowrap {white-space: nowrap}
/* Forms */
fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
@ -41,16 +42,18 @@ width:94px; height:26px;
background:url(img/buttons.png) 0 -26px;
cursor:pointer;
padding-bottom:2px;
float:left;
}
#insert {background:url(img/buttons.png) 0 -52px;}
#cancel {background:url(img/buttons.png) 0 0;}
#insert {background:url(img/buttons.png) 0 -52px}
#cancel {background:url(img/buttons.png) 0 0; float:right}
/* Browse */
a.pickcolor, a.browse {text-decoration:none}
a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}
.mceOldBoxModel a.browse span {width:22px; height:20px;}
a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}
a.browse span.disabled {border:1px solid white; -moz-opacity:0.3; opacity:0.3; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);}
a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}
a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;}
.mceOldBoxModel a.pickcolor span {width:21px; height:17px;}
@ -111,4 +114,4 @@ h3 {font-size:14px;}
#colorpicker #namedcolors {width:150px;}
#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}
#colorpicker #colornamecontainer {margin-top:5px;}
#colorpicker #picker_panel fieldset {margin:auto;width:325px;}
#colorpicker #picker_panel fieldset {margin:auto;width:325px;}

View File

@ -4,7 +4,7 @@
.defaultSkin table td {vertical-align:middle}
/* Containers */
.defaultSkin table {background:#F0F0EE}
.defaultSkin table {direction:ltr; background:#F0F0EE}
.defaultSkin iframe {display:block; background:#FFF}
.defaultSkin .mceToolbar {height:26px}
.defaultSkin .mceLeft {text-align:left}
@ -24,7 +24,7 @@
.defaultSkin .mceIframeContainer {border-top:1px solid #CCC; border-bottom:1px solid #CCC}
.defaultSkin .mceStatusbar {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; display:block; height:20px}
.defaultSkin .mceStatusbar div {float:left; margin:2px}
.defaultSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize}
.defaultSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0}
.defaultSkin .mceStatusbar a:hover {text-decoration:underline}
.defaultSkin table.mceToolbar {margin-left:3px}
.defaultSkin span.mceIcon, .defaultSkin img.mceIcon {display:block; width:20px; height:20px}
@ -37,7 +37,7 @@
.defaultSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px; margin-right:1px}
.defaultSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0}
.defaultSkin a.mceButtonActive, .defaultSkin a.mceButtonSelected {border:1px solid #0A246A; background-color:#C2CBE0}
.defaultSkin .mceButtonDisabled .mceIcon {opacity:0.3; filter:alpha(opacity=30)}
.defaultSkin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
.defaultSkin .mceButtonLabeled {width:auto}
.defaultSkin .mceButtonLabeled span.mceIcon {float:left}
.defaultSkin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica}
@ -47,12 +47,9 @@
.defaultSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:2px 2px 0 4px}
/* ListBox */
.defaultSkin .mceListBox {direction:ltr}
.defaultSkin .mceListBox, .defaultSkin .mceListBox a {display:block}
/* width changed to 65px by Dan S./Zotero */
.defaultSkin .mceListBox .mceText {padding-left:4px; width:65px; text-align:left; border:1px solid #CCC; border-right:0; background:#FFF; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden}
/* margin-right changed to 1px by Dan S./Zotero */
.defaultSkin .mceListBox .mceOpen {width:9px; height:20px; background:url(../../img/icons.gif) -741px 0; margin-right:1px; border:1px solid #CCC;}
.defaultSkin .mceListBox .mceText {padding-left:4px; width:70px; text-align:left; border:1px solid #CCC; border-right:0; background:#FFF; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden}
.defaultSkin .mceListBox .mceOpen {width:9px; height:20px; background:url(../../img/icons.gif) -741px 0; margin-right:2px; border:1px solid #CCC;}
.defaultSkin table.mceListBoxEnabled:hover .mceText, .defaultSkin .mceListBoxHover .mceText, .defaultSkin .mceListBoxSelected .mceText {border:1px solid #A2ABC0; border-right:0; background:#FFF}
.defaultSkin table.mceListBoxEnabled:hover .mceOpen, .defaultSkin .mceListBoxHover .mceOpen, .defaultSkin .mceListBoxSelected .mceOpen {background-color:#FFF; border:1px solid #A2ABC0}
.defaultSkin .mceListBoxDisabled a.mceText {color:gray; background-color:transparent;}
@ -65,13 +62,12 @@
.defaultSkin .mceSplitButton {width:32px; height:20px; direction:ltr}
.defaultSkin .mceSplitButton a, .defaultSkin .mceSplitButton span {height:20px; display:block}
.defaultSkin .mceSplitButton a.mceAction {width:20px; border:1px solid #F0F0EE; border-right:0;}
.defaultSkin .mceSplitButton span.mceAction {width:20px; background:url(../../img/icons.gif) 20px 20px;}
.defaultSkin .mceSplitButton a.mceOpen {width:9px; border:1px solid #F0F0EE;}
.defaultSkin .mceSplitButton span.mceOpen {width:9px; background:url(../../img/icons.gif) -741px 0;}
.defaultSkin .mceSplitButton span.mceAction {width:20px; background-image:url(../../img/icons.gif);}
.defaultSkin .mceSplitButton a.mceOpen {width:9px; background:url(../../img/icons.gif) -741px 0; border:1px solid #F0F0EE;}
.defaultSkin .mceSplitButton span.mceOpen {display:none}
.defaultSkin table.mceSplitButtonEnabled:hover a.mceAction, .defaultSkin .mceSplitButtonHover a.mceAction, .defaultSkin .mceSplitButtonSelected a.mceAction {border:1px solid #0A246A; border-right:0; background-color:#B2BBD0}
.defaultSkin table.mceSplitButtonEnabled:hover a.mceOpen, .defaultSkin .mceSplitButtonHover a.mceOpen, .defaultSkin .mceSplitButtonSelected a.mceOpen {border:1px solid #0A246A;}
.defaultSkin table.mceSplitButtonEnabled:hover span.mceOpen, .defaultSkin .mceSplitButtonHover span.mceOpen, .defaultSkin .mceSplitButtonSelected span.mceOpen {background-color:#B2BBD0}
.defaultSkin .mceSplitButtonDisabled .mceAction, .defaultSkin .mceSplitButtonDisabled span.mceOpen {opacity:0.3; filter:alpha(opacity=30)}
.defaultSkin table.mceSplitButtonEnabled:hover a.mceOpen, .defaultSkin .mceSplitButtonHover a.mceOpen, .defaultSkin .mceSplitButtonSelected a.mceOpen {background-color:#B2BBD0; border:1px solid #0A246A;}
.defaultSkin .mceSplitButtonDisabled .mceAction, .defaultSkin .mceSplitButtonDisabled a.mceOpen {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
.defaultSkin .mceSplitButtonActive a.mceAction {border:1px solid #0A246A; background-color:#C2CBE0}
.defaultSkin .mceSplitButtonActive a.mceOpen {border-left:0;}
@ -109,9 +105,8 @@
.defaultSkin .mceMenuItemSub a {background:url(img/menu_arrow.gif) no-repeat top right;}
/* Progress,Resize */
.defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; filter:alpha(opacity=50); background:#FFF}
.defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50); background:#FFF}
.defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
.defaultSkin .mcePlaceHolder {border:1px dotted gray}
/* Formats */
.defaultSkin .mce_formatPreview a {font-size:10px}
@ -214,4 +209,5 @@
.defaultSkin span.mce_del {background-position:-940px -20px}
.defaultSkin span.mce_ins {background-position:-960px -20px}
.defaultSkin span.mce_pagebreak {background-position:0 -40px}
.defaultSkin .mce_spellchecker span.mceAction {background-position:-540px -20px}
.defaultSkin span.mce_restoredraft {background-position:-20px -40px}
.defaultSkin span.mce_spellchecker {background-position:-540px -20px}

View File

@ -1,10 +1,8 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>{#advanced_dlg.code_title}</title>
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="js/source_editor.js"></script>
<base target="_self" />
</head>
<body onresize="resizeInputs();" style="display:none; overflow:hidden;">
<form name="source" onsubmit="saveContent();return false;" action="#">
@ -19,13 +17,8 @@
<textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,monospace; font-size: 12px;" dir="ltr" wrap="off" class="mceFocus"></textarea>
<div class="mceActionPanel">
<div style="float: left">
<input type="submit" name="insert" value="{#update}" id="insert" />
</div>
<div style="float: right">
<input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
</div>
<input type="submit" name="insert" value="{#update}" id="insert" />
<input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
</div>
</form>
</body>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,11 @@
/**
* $Id: editable_selects.js 867 2008-06-09 20:33:40Z spocke $
* editable_selects.js
*
* Makes select boxes editable.
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* @author Moxiecode
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
var TinyMCE_EditableSelects = {

View File

@ -1,10 +1,11 @@
/**
* $Id: form_utils.js 673 2008-03-06 13:26:20Z spocke $
* form_utils.js
*
* Various form utilitiy functions.
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* @author Moxiecode
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme"));
@ -13,7 +14,7 @@ function getColorPickerHTML(id, target_form_element) {
var h = "";
h += '<a id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">';
h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"></span></a>';
h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;</span></a>';
return h;
}
@ -50,7 +51,7 @@ function getBrowserHTML(id, target_form_element, type, prefix) {
html = "";
html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">';
html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"></span></a>';
html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;</span></a>';
return html;
}
@ -92,7 +93,7 @@ function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
function getSelectValue(form_obj, field_name) {
var elm = form_obj.elements[field_name];
if (elm == null || elm.options == null)
if (elm == null || elm.options == null || elm.selectedIndex === -1)
return "";
return elm.options[elm.selectedIndex].value;

View File

@ -1,10 +1,11 @@
/**
* $Id: mctabs.js 758 2008-03-30 13:53:29Z spocke $
* mctabs.js
*
* Moxiecode DHTML Tabs script.
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* @author Moxiecode
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
function MCTabs() {

View File

@ -1,10 +1,11 @@
/**
* $Id: validate.js 758 2008-03-30 13:53:29Z spocke $
* validate.js
*
* Various form validation methods.
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* @author Moxiecode
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
/**