Update TinyMCE to 3.5.3, enable stripping of Word styles on paste
This commit is contained in:
parent
83404c2c80
commit
48790b7525
274 changed files with 25268 additions and 14504 deletions
3
webapp/web/js/tiny_mce/themes/advanced/js/about.js
vendored
Executable file → Normal file
3
webapp/web/js/tiny_mce/themes/advanced/js/about.js
vendored
Executable file → Normal file
|
@ -7,7 +7,7 @@ function init() {
|
|||
ed = tinyMCEPopup.editor;
|
||||
|
||||
// Give FF some time
|
||||
window.setTimeout('insertHelpIFrame();', 10);
|
||||
window.setTimeout(insertHelpIFrame, 10);
|
||||
|
||||
tcont = document.getElementById('plugintablecontainer');
|
||||
document.getElementById('plugins_tab').style.display = 'none';
|
||||
|
@ -66,6 +66,7 @@ function insertHelpIFrame() {
|
|||
html = '<iframe width="100%" height="300" src="' + tinyMCEPopup.editor.baseURI.toAbsolute(tinyMCEPopup.getParam('docs_url')) + '"></iframe>';
|
||||
document.getElementById('iframecontainer').innerHTML = html;
|
||||
document.getElementById('help_tab').style.display = 'block';
|
||||
document.getElementById('help_tab').setAttribute("aria-hidden", "false");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
37
webapp/web/js/tiny_mce/themes/advanced/js/anchor.js
vendored
Executable file → Normal file
37
webapp/web/js/tiny_mce/themes/advanced/js/anchor.js
vendored
Executable file → Normal file
|
@ -5,8 +5,8 @@ var AnchorDialog = {
|
|||
var action, elm, f = document.forms[0];
|
||||
|
||||
this.editor = ed;
|
||||
elm = ed.dom.getParent(ed.selection.getNode(), 'A,IMG');
|
||||
v = ed.dom.getAttrib(elm, 'name');
|
||||
elm = ed.dom.getParent(ed.selection.getNode(), 'A');
|
||||
v = ed.dom.getAttrib(elm, 'name') || ed.dom.getAttrib(elm, 'id');
|
||||
|
||||
if (v) {
|
||||
this.action = 'update';
|
||||
|
@ -17,18 +17,37 @@ var AnchorDialog = {
|
|||
},
|
||||
|
||||
update : function() {
|
||||
var ed = this.editor;
|
||||
|
||||
var ed = this.editor, elm, name = document.forms[0].anchorName.value, attribName;
|
||||
|
||||
if (!name || !/^[a-z][a-z0-9\-\_:\.]*$/i.test(name)) {
|
||||
tinyMCEPopup.alert('advanced_dlg.anchor_invalid');
|
||||
return;
|
||||
}
|
||||
|
||||
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'}));
|
||||
else
|
||||
ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}, ''));
|
||||
var aRule = ed.schema.getElementRule('a');
|
||||
if (!aRule || aRule.attributes.name) {
|
||||
attribName = 'name';
|
||||
} else {
|
||||
attribName = 'id';
|
||||
}
|
||||
|
||||
elm = ed.dom.getParent(ed.selection.getNode(), 'A');
|
||||
if (elm) {
|
||||
elm.setAttribute(attribName, name);
|
||||
elm[attribName] = name;
|
||||
ed.undoManager.add();
|
||||
} else {
|
||||
// create with zero-sized nbsp so that in Webkit where anchor is on last line by itself caret cannot be placed after it
|
||||
var attrs = {'class' : 'mceItemAnchor'};
|
||||
attrs[attribName] = name;
|
||||
ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', attrs, '\uFEFF'));
|
||||
ed.nodeChanged();
|
||||
}
|
||||
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
|
50
webapp/web/js/tiny_mce/themes/advanced/js/charmap.js
vendored
Executable file → Normal file
50
webapp/web/js/tiny_mce/themes/advanced/js/charmap.js
vendored
Executable file → Normal 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 = [
|
||||
|
@ -163,7 +173,7 @@ var charmap = [
|
|||
['ý', 'ý', true, 'y - acute'],
|
||||
['þ', 'þ', true, 'thorn'],
|
||||
['ÿ', 'ÿ', true, 'y - diaeresis'],
|
||||
['Α', 'Α', true, 'Alpha'],
|
||||
['Α', 'Α', true, 'Alpha'],
|
||||
['Β', 'Β', true, 'Beta'],
|
||||
['Γ', 'Γ', true, 'Gamma'],
|
||||
['Δ', 'Δ', true, 'Delta'],
|
||||
|
@ -248,8 +258,8 @@ var charmap = [
|
|||
['⌋', '⌋', false,'right floor'],
|
||||
['⟨', '〈', false,'left-pointing angle bracket'],
|
||||
['⟩', '〉', false,'right-pointing angle bracket'],
|
||||
['◊', '◊', true,'lozenge'],
|
||||
['♠', '♠', false,'black spade suit'],
|
||||
['◊', '◊', true, 'lozenge'],
|
||||
['♠', '♠', true, 'black spade suit'],
|
||||
['♣', '♣', true, 'black club suit'],
|
||||
['♥', '♥', true, 'black heart suit'],
|
||||
['♦', '♦', true, 'black diamond suit'],
|
||||
|
@ -265,19 +275,46 @@ var charmap = [
|
|||
|
||||
tinyMCEPopup.onInit.add(function() {
|
||||
tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML());
|
||||
addKeyboardNavigation();
|
||||
});
|
||||
|
||||
function addKeyboardNavigation(){
|
||||
var tableElm, cells, settings;
|
||||
|
||||
cells = tinyMCEPopup.dom.select("a.charmaplink", "charmapgroup");
|
||||
|
||||
settings ={
|
||||
root: "charmapgroup",
|
||||
items: cells
|
||||
};
|
||||
cells[0].tabindex=0;
|
||||
tinyMCEPopup.dom.addClass(cells[0], "mceFocus");
|
||||
if (tinymce.isGecko) {
|
||||
cells[0].focus();
|
||||
} else {
|
||||
setTimeout(function(){
|
||||
cells[0].focus();
|
||||
}, 100);
|
||||
}
|
||||
tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom);
|
||||
}
|
||||
|
||||
function renderCharMapHTML() {
|
||||
var charsPerRow = 20, tdWidth=20, tdHeight=20, i;
|
||||
var html = '<table border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) + '"><tr height="' + tdHeight + '">';
|
||||
var html = '<div id="charmapgroup" aria-labelledby="charmap_label" tabindex="0" role="listbox">'+
|
||||
'<table role="presentation" border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) +
|
||||
'"><tr height="' + tdHeight + '">';
|
||||
var cols=-1;
|
||||
|
||||
for (i=0; i<charmap.length; i++) {
|
||||
var previewCharFn;
|
||||
|
||||
if (charmap[i][2]==true) {
|
||||
cols++;
|
||||
previewCharFn = 'previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');';
|
||||
html += ''
|
||||
+ '<td class="charmap">'
|
||||
+ '<a onmouseover="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" onfocus="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" href="javascript:void(0)" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + '">'
|
||||
+ '<a class="charmaplink" role="button" onmouseover="'+previewCharFn+'" onfocus="'+previewCharFn+'" href="javascript:void(0)" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + ' '+ tinyMCEPopup.editor.translate("advanced_dlg.charmap_usage")+'">'
|
||||
+ charmap[i][1]
|
||||
+ '</a></td>';
|
||||
if ((cols+1) % charsPerRow == 0)
|
||||
|
@ -291,7 +328,8 @@ function renderCharMapHTML() {
|
|||
html += '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap"> </td>';
|
||||
}
|
||||
|
||||
html += '</tr></table>';
|
||||
html += '</tr></table></div>';
|
||||
html = html.replace(/<tr height="20"><\/tr>/g, '');
|
||||
|
||||
return html;
|
||||
}
|
||||
|
|
166
webapp/web/js/tiny_mce/themes/advanced/js/color_picker.js
vendored
Executable file → Normal file
166
webapp/web/js/tiny_mce/themes/advanced/js/color_picker.js
vendored
Executable file → Normal file
|
@ -33,37 +33,41 @@ var colors = [
|
|||
];
|
||||
|
||||
var named = {
|
||||
'#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige',
|
||||
'#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'BlanchedAlmond','#0000FF':'Blue','#8A2BE2':'BlueViolet','#A52A2A':'Brown',
|
||||
'#DEB887':'BurlyWood','#5F9EA0':'CadetBlue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'CornflowerBlue',
|
||||
'#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'DarkBlue','#008B8B':'DarkCyan','#B8860B':'DarkGoldenRod',
|
||||
'#A9A9A9':'DarkGray','#A9A9A9':'DarkGrey','#006400':'DarkGreen','#BDB76B':'DarkKhaki','#8B008B':'DarkMagenta','#556B2F':'DarkOliveGreen',
|
||||
'#FF8C00':'Darkorange','#9932CC':'DarkOrchid','#8B0000':'DarkRed','#E9967A':'DarkSalmon','#8FBC8F':'DarkSeaGreen','#483D8B':'DarkSlateBlue',
|
||||
'#2F4F4F':'DarkSlateGray','#2F4F4F':'DarkSlateGrey','#00CED1':'DarkTurquoise','#9400D3':'DarkViolet','#FF1493':'DeepPink','#00BFFF':'DeepSkyBlue',
|
||||
'#696969':'DimGray','#696969':'DimGrey','#1E90FF':'DodgerBlue','#B22222':'FireBrick','#FFFAF0':'FloralWhite','#228B22':'ForestGreen',
|
||||
'#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'GhostWhite','#FFD700':'Gold','#DAA520':'GoldenRod','#808080':'Gray','#808080':'Grey',
|
||||
'#008000':'Green','#ADFF2F':'GreenYellow','#F0FFF0':'HoneyDew','#FF69B4':'HotPink','#CD5C5C':'IndianRed','#4B0082':'Indigo','#FFFFF0':'Ivory',
|
||||
'#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'LavenderBlush','#7CFC00':'LawnGreen','#FFFACD':'LemonChiffon','#ADD8E6':'LightBlue',
|
||||
'#F08080':'LightCoral','#E0FFFF':'LightCyan','#FAFAD2':'LightGoldenRodYellow','#D3D3D3':'LightGray','#D3D3D3':'LightGrey','#90EE90':'LightGreen',
|
||||
'#FFB6C1':'LightPink','#FFA07A':'LightSalmon','#20B2AA':'LightSeaGreen','#87CEFA':'LightSkyBlue','#778899':'LightSlateGray','#778899':'LightSlateGrey',
|
||||
'#B0C4DE':'LightSteelBlue','#FFFFE0':'LightYellow','#00FF00':'Lime','#32CD32':'LimeGreen','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon',
|
||||
'#66CDAA':'MediumAquaMarine','#0000CD':'MediumBlue','#BA55D3':'MediumOrchid','#9370D8':'MediumPurple','#3CB371':'MediumSeaGreen','#7B68EE':'MediumSlateBlue',
|
||||
'#00FA9A':'MediumSpringGreen','#48D1CC':'MediumTurquoise','#C71585':'MediumVioletRed','#191970':'MidnightBlue','#F5FFFA':'MintCream','#FFE4E1':'MistyRose','#FFE4B5':'Moccasin',
|
||||
'#FFDEAD':'NavajoWhite','#000080':'Navy','#FDF5E6':'OldLace','#808000':'Olive','#6B8E23':'OliveDrab','#FFA500':'Orange','#FF4500':'OrangeRed','#DA70D6':'Orchid',
|
||||
'#EEE8AA':'PaleGoldenRod','#98FB98':'PaleGreen','#AFEEEE':'PaleTurquoise','#D87093':'PaleVioletRed','#FFEFD5':'PapayaWhip','#FFDAB9':'PeachPuff',
|
||||
'#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'PowderBlue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'RosyBrown','#4169E1':'RoyalBlue',
|
||||
'#8B4513':'SaddleBrown','#FA8072':'Salmon','#F4A460':'SandyBrown','#2E8B57':'SeaGreen','#FFF5EE':'SeaShell','#A0522D':'Sienna','#C0C0C0':'Silver',
|
||||
'#87CEEB':'SkyBlue','#6A5ACD':'SlateBlue','#708090':'SlateGray','#708090':'SlateGrey','#FFFAFA':'Snow','#00FF7F':'SpringGreen',
|
||||
'#4682B4':'SteelBlue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet',
|
||||
'#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'WhiteSmoke','#FFFF00':'Yellow','#9ACD32':'YellowGreen'
|
||||
'#F0F8FF':'Alice Blue','#FAEBD7':'Antique White','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige',
|
||||
'#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'Blanched Almond','#0000FF':'Blue','#8A2BE2':'Blue Violet','#A52A2A':'Brown',
|
||||
'#DEB887':'Burly Wood','#5F9EA0':'Cadet Blue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'Cornflower Blue',
|
||||
'#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'Dark Blue','#008B8B':'Dark Cyan','#B8860B':'Dark Golden Rod',
|
||||
'#A9A9A9':'Dark Gray','#A9A9A9':'Dark Grey','#006400':'Dark Green','#BDB76B':'Dark Khaki','#8B008B':'Dark Magenta','#556B2F':'Dark Olive Green',
|
||||
'#FF8C00':'Darkorange','#9932CC':'Dark Orchid','#8B0000':'Dark Red','#E9967A':'Dark Salmon','#8FBC8F':'Dark Sea Green','#483D8B':'Dark Slate Blue',
|
||||
'#2F4F4F':'Dark Slate Gray','#2F4F4F':'Dark Slate Grey','#00CED1':'Dark Turquoise','#9400D3':'Dark Violet','#FF1493':'Deep Pink','#00BFFF':'Deep Sky Blue',
|
||||
'#696969':'Dim Gray','#696969':'Dim Grey','#1E90FF':'Dodger Blue','#B22222':'Fire Brick','#FFFAF0':'Floral White','#228B22':'Forest Green',
|
||||
'#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'Ghost White','#FFD700':'Gold','#DAA520':'Golden Rod','#808080':'Gray','#808080':'Grey',
|
||||
'#008000':'Green','#ADFF2F':'Green Yellow','#F0FFF0':'Honey Dew','#FF69B4':'Hot Pink','#CD5C5C':'Indian Red','#4B0082':'Indigo','#FFFFF0':'Ivory',
|
||||
'#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'Lavender Blush','#7CFC00':'Lawn Green','#FFFACD':'Lemon Chiffon','#ADD8E6':'Light Blue',
|
||||
'#F08080':'Light Coral','#E0FFFF':'Light Cyan','#FAFAD2':'Light Golden Rod Yellow','#D3D3D3':'Light Gray','#D3D3D3':'Light Grey','#90EE90':'Light Green',
|
||||
'#FFB6C1':'Light Pink','#FFA07A':'Light Salmon','#20B2AA':'Light Sea Green','#87CEFA':'Light Sky Blue','#778899':'Light Slate Gray','#778899':'Light Slate Grey',
|
||||
'#B0C4DE':'Light Steel Blue','#FFFFE0':'Light Yellow','#00FF00':'Lime','#32CD32':'Lime Green','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon',
|
||||
'#66CDAA':'Medium Aqua Marine','#0000CD':'Medium Blue','#BA55D3':'Medium Orchid','#9370D8':'Medium Purple','#3CB371':'Medium Sea Green','#7B68EE':'Medium Slate Blue',
|
||||
'#00FA9A':'Medium Spring Green','#48D1CC':'Medium Turquoise','#C71585':'Medium Violet Red','#191970':'Midnight Blue','#F5FFFA':'Mint Cream','#FFE4E1':'Misty Rose','#FFE4B5':'Moccasin',
|
||||
'#FFDEAD':'Navajo White','#000080':'Navy','#FDF5E6':'Old Lace','#808000':'Olive','#6B8E23':'Olive Drab','#FFA500':'Orange','#FF4500':'Orange Red','#DA70D6':'Orchid',
|
||||
'#EEE8AA':'Pale Golden Rod','#98FB98':'Pale Green','#AFEEEE':'Pale Turquoise','#D87093':'Pale Violet Red','#FFEFD5':'Papaya Whip','#FFDAB9':'Peach Puff',
|
||||
'#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'Powder Blue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'Rosy Brown','#4169E1':'Royal Blue',
|
||||
'#8B4513':'Saddle Brown','#FA8072':'Salmon','#F4A460':'Sandy Brown','#2E8B57':'Sea Green','#FFF5EE':'Sea Shell','#A0522D':'Sienna','#C0C0C0':'Silver',
|
||||
'#87CEEB':'Sky Blue','#6A5ACD':'Slate Blue','#708090':'Slate Gray','#708090':'Slate Grey','#FFFAFA':'Snow','#00FF7F':'Spring Green',
|
||||
'#4682B4':'Steel Blue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet',
|
||||
'#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'White Smoke','#FFFF00':'Yellow','#9ACD32':'Yellow Green'
|
||||
};
|
||||
|
||||
var namedLookup = {};
|
||||
|
||||
function init() {
|
||||
var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color'));
|
||||
var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color')), key, value;
|
||||
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
|
||||
generatePicker();
|
||||
generateWebColors();
|
||||
generateNamedColors();
|
||||
|
||||
if (inputColor) {
|
||||
changeFinalColor(inputColor);
|
||||
|
@ -73,17 +77,72 @@ function init() {
|
|||
if (col)
|
||||
updateLight(col.r, col.g, col.b);
|
||||
}
|
||||
|
||||
for (key in named) {
|
||||
value = named[key];
|
||||
namedLookup[value.replace(/\s+/, '').toLowerCase()] = key.replace(/#/, '').toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
function toHexColor(color) {
|
||||
var matches, red, green, blue, toInt = parseInt;
|
||||
|
||||
function hex(value) {
|
||||
value = parseInt(value).toString(16);
|
||||
|
||||
return value.length > 1 ? value : '0' + value; // Padd with leading zero
|
||||
};
|
||||
|
||||
color = tinymce.trim(color);
|
||||
color = color.replace(/^[#]/, '').toLowerCase(); // remove leading '#'
|
||||
color = namedLookup[color] || color;
|
||||
|
||||
matches = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/.exec(color);
|
||||
|
||||
if (matches) {
|
||||
red = toInt(matches[1]);
|
||||
green = toInt(matches[2]);
|
||||
blue = toInt(matches[3]);
|
||||
} else {
|
||||
matches = /^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/.exec(color);
|
||||
|
||||
if (matches) {
|
||||
red = toInt(matches[1], 16);
|
||||
green = toInt(matches[2], 16);
|
||||
blue = toInt(matches[3], 16);
|
||||
} else {
|
||||
matches = /^([0-9a-f])([0-9a-f])([0-9a-f])$/.exec(color);
|
||||
|
||||
if (matches) {
|
||||
red = toInt(matches[1] + matches[1], 16);
|
||||
green = toInt(matches[2] + matches[2], 16);
|
||||
blue = toInt(matches[3] + matches[3], 16);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return '#' + hex(red) + hex(green) + hex(blue);
|
||||
}
|
||||
|
||||
function insertAction() {
|
||||
var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func');
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
var hexColor = toHexColor(color);
|
||||
|
||||
if (f)
|
||||
f(color);
|
||||
if (hexColor === '') {
|
||||
var text = tinyMCEPopup.editor.getLang('advanced_dlg.invalid_color_value');
|
||||
tinyMCEPopup.alert(text + ': ' + color);
|
||||
}
|
||||
else {
|
||||
tinyMCEPopup.restoreSelection();
|
||||
|
||||
tinyMCEPopup.close();
|
||||
if (f)
|
||||
f(hexColor);
|
||||
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
}
|
||||
|
||||
function showColor(color, name) {
|
||||
|
@ -91,7 +150,7 @@ function showColor(color, name) {
|
|||
document.getElementById("colorname").innerHTML = name;
|
||||
|
||||
document.getElementById("preview").style.backgroundColor = color;
|
||||
document.getElementById("color").value = color.toLowerCase();
|
||||
document.getElementById("color").value = color.toUpperCase();
|
||||
}
|
||||
|
||||
function convertRGBToHex(col) {
|
||||
|
@ -153,23 +212,40 @@ function generateWebColors() {
|
|||
if (el.className == 'generated')
|
||||
return;
|
||||
|
||||
h += '<table border="0" cellspacing="1" cellpadding="0">'
|
||||
// TODO: VoiceOver doesn't seem to support legend as a label referenced by labelledby.
|
||||
h += '<div role="listbox" aria-labelledby="webcolors_title" tabindex="0"><table role="presentation" border="0" cellspacing="1" cellpadding="0">'
|
||||
+ '<tr>';
|
||||
|
||||
for (i=0; i<colors.length; i++) {
|
||||
h += '<td bgcolor="' + colors[i] + '" width="10" height="10">'
|
||||
+ '<a href="javascript:insertAction();" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');" style="display:block;width:10px;height:10px;overflow:hidden;">'
|
||||
+ '</a></td>';
|
||||
+ '<a href="javascript:insertAction();" role="option" tabindex="-1" aria-labelledby="web_colors_' + i + '" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');" style="display:block;width:10px;height:10px;overflow:hidden;">';
|
||||
if (tinyMCEPopup.editor.forcedHighContrastMode) {
|
||||
h += '<canvas class="mceColorSwatch" height="10" width="10" data-color="' + colors[i] + '"></canvas>';
|
||||
}
|
||||
h += '<span class="mceVoiceLabel" style="display:none;" id="web_colors_' + i + '">' + colors[i].toUpperCase() + '</span>';
|
||||
h += '</a></td>';
|
||||
if ((i+1) % 18 == 0)
|
||||
h += '</tr><tr>';
|
||||
}
|
||||
|
||||
h += '</table>';
|
||||
h += '</table></div>';
|
||||
|
||||
el.innerHTML = h;
|
||||
el.className = 'generated';
|
||||
|
||||
paintCanvas(el);
|
||||
enableKeyboardNavigation(el.firstChild);
|
||||
}
|
||||
|
||||
function paintCanvas(el) {
|
||||
tinyMCEPopup.getWin().tinymce.each(tinyMCEPopup.dom.select('canvas.mceColorSwatch', el), function(canvas) {
|
||||
var context;
|
||||
if (canvas.getContext && (context = canvas.getContext("2d"))) {
|
||||
context.fillStyle = canvas.getAttribute('data-color');
|
||||
context.fillRect(0, 0, 10, 10);
|
||||
}
|
||||
});
|
||||
}
|
||||
function generateNamedColors() {
|
||||
var el = document.getElementById('namedcolors'), h = '', n, v, i = 0;
|
||||
|
||||
|
@ -178,11 +254,27 @@ function generateNamedColors() {
|
|||
|
||||
for (n in named) {
|
||||
v = named[n];
|
||||
h += '<a href="javascript:insertAction();" onmouseover="showColor(\'' + n + '\',\'' + v + '\');" style="background-color: ' + n + '"><!-- IE --></a>'
|
||||
h += '<a href="javascript:insertAction();" role="option" tabindex="-1" aria-labelledby="named_colors_' + i + '" onfocus="showColor(\'' + n + '\',\'' + v + '\');" onmouseover="showColor(\'' + n + '\',\'' + v + '\');" style="background-color: ' + n + '">';
|
||||
if (tinyMCEPopup.editor.forcedHighContrastMode) {
|
||||
h += '<canvas class="mceColorSwatch" height="10" width="10" data-color="' + colors[i] + '"></canvas>';
|
||||
}
|
||||
h += '<span class="mceVoiceLabel" style="display:none;" id="named_colors_' + i + '">' + v + '</span>';
|
||||
h += '</a>';
|
||||
i++;
|
||||
}
|
||||
|
||||
el.innerHTML = h;
|
||||
el.className = 'generated';
|
||||
|
||||
paintCanvas(el);
|
||||
enableKeyboardNavigation(el);
|
||||
}
|
||||
|
||||
function enableKeyboardNavigation(el) {
|
||||
tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {
|
||||
root: el,
|
||||
items: tinyMCEPopup.dom.select('a', el)
|
||||
}, tinyMCEPopup.dom);
|
||||
}
|
||||
|
||||
function dechex(n) {
|
||||
|
@ -190,10 +282,10 @@ function dechex(n) {
|
|||
}
|
||||
|
||||
function computeColor(e) {
|
||||
var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB;
|
||||
var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB, pos = tinyMCEPopup.dom.getPos(e.target);
|
||||
|
||||
x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0);
|
||||
y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0);
|
||||
x = e.offsetX ? e.offsetX : (e.target ? e.clientX - pos.x : 0);
|
||||
y = e.offsetY ? e.offsetY : (e.target ? e.clientY - pos.y : 0);
|
||||
|
||||
partWidth = document.getElementById('colors').width / 6;
|
||||
partDetail = detail / 2;
|
||||
|
|
28
webapp/web/js/tiny_mce/themes/advanced/js/image.js
vendored
Executable file → Normal file
28
webapp/web/js/tiny_mce/themes/advanced/js/image.js
vendored
Executable file → Normal file
|
@ -18,7 +18,7 @@ var ImageDialog = {
|
|||
|
||||
e = ed.selection.getNode();
|
||||
|
||||
this.fillFileList('image_list', 'tinyMCEImageList');
|
||||
this.fillFileList('image_list', tinyMCEPopup.getParam('external_image_list', 'tinyMCEImageList'));
|
||||
|
||||
if (e.nodeName == 'IMG') {
|
||||
f.src.value = ed.dom.getAttrib(e, 'src');
|
||||
|
@ -39,7 +39,7 @@ var ImageDialog = {
|
|||
fillFileList : function(id, l) {
|
||||
var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
|
||||
|
||||
l = window[l];
|
||||
l = typeof(l) === 'function' ? l() : window[l];
|
||||
|
||||
if (l && l.length > 0) {
|
||||
lst.options[lst.options.length] = new Option('', '');
|
||||
|
@ -77,7 +77,7 @@ var ImageDialog = {
|
|||
args.style = this.styleVal;
|
||||
|
||||
tinymce.extend(args, {
|
||||
src : f.src.value,
|
||||
src : f.src.value.replace(/ /g, '%20'),
|
||||
alt : f.alt.value,
|
||||
width : f.width.value,
|
||||
height : f.height.value
|
||||
|
@ -87,10 +87,16 @@ var ImageDialog = {
|
|||
|
||||
if (el && el.nodeName == 'IMG') {
|
||||
ed.dom.setAttribs(el, args);
|
||||
tinyMCEPopup.editor.execCommand('mceRepaint');
|
||||
tinyMCEPopup.editor.focus();
|
||||
} else {
|
||||
ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', {skip_undo : 1});
|
||||
ed.dom.setAttribs('__mce_tmp', args);
|
||||
ed.dom.setAttrib('__mce_tmp', 'id', '');
|
||||
tinymce.each(args, function(value, name) {
|
||||
if (value === "") {
|
||||
delete args[name];
|
||||
}
|
||||
});
|
||||
|
||||
ed.execCommand('mceInsertContent', false, tinyMCEPopup.editor.dom.createHTML('img', args), {skip_undo : 1});
|
||||
ed.undoManager.add();
|
||||
}
|
||||
|
||||
|
@ -98,10 +104,12 @@ var ImageDialog = {
|
|||
},
|
||||
|
||||
updateStyle : function() {
|
||||
var dom = tinyMCEPopup.dom, st, v, f = document.forms[0];
|
||||
var dom = tinyMCEPopup.dom, st = {}, v, f = document.forms[0];
|
||||
|
||||
if (tinyMCEPopup.editor.settings.inline_styles) {
|
||||
st = tinyMCEPopup.dom.parseStyle(this.styleVal);
|
||||
tinymce.each(tinyMCEPopup.dom.parseStyle(this.styleVal), function(value, key) {
|
||||
st[key] = value;
|
||||
});
|
||||
|
||||
// Handle align
|
||||
v = getSelectValue(f, 'align');
|
||||
|
@ -151,8 +159,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');
|
||||
}
|
||||
},
|
||||
|
||||
|
|
30
webapp/web/js/tiny_mce/themes/advanced/js/link.js
vendored
Executable file → Normal file
30
webapp/web/js/tiny_mce/themes/advanced/js/link.js
vendored
Executable file → Normal file
|
@ -31,7 +31,7 @@ var LinkDialog = {
|
|||
},
|
||||
|
||||
update : function() {
|
||||
var f = document.forms[0], ed = tinyMCEPopup.editor, e, b;
|
||||
var f = document.forms[0], ed = tinyMCEPopup.editor, e, b, href = f.href.value.replace(/ /g, '%20');
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
e = ed.dom.getParent(ed.selection.getNode(), 'A');
|
||||
|
@ -39,7 +39,6 @@ var LinkDialog = {
|
|||
// Remove element if there is no href
|
||||
if (!f.href.value) {
|
||||
if (e) {
|
||||
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
||||
b = ed.selection.getBookmark();
|
||||
ed.dom.remove(e, 1);
|
||||
ed.selection.moveToBookmark(b);
|
||||
|
@ -49,31 +48,36 @@ var LinkDialog = {
|
|||
}
|
||||
}
|
||||
|
||||
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
||||
|
||||
// Create new anchor elements
|
||||
if (e == null) {
|
||||
tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
|
||||
ed.getDoc().execCommand("unlink", false, null);
|
||||
tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1});
|
||||
|
||||
tinymce.each(ed.dom.select("a"), function(n) {
|
||||
if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
|
||||
e = n;
|
||||
|
||||
ed.dom.setAttribs(e, {
|
||||
href : f.href.value,
|
||||
href : href,
|
||||
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
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
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
|
||||
href : href,
|
||||
title : f.linktitle.value
|
||||
});
|
||||
|
||||
if (f.target_list) {
|
||||
ed.dom.setAttrib(e, 'target', getSelectValue(f, "target_list"));
|
||||
}
|
||||
|
||||
if (f.class_list) {
|
||||
ed.dom.setAttrib(e, 'class', getSelectValue(f, "class_list"));
|
||||
}
|
||||
}
|
||||
|
||||
// Don't move caret if selection was image
|
||||
|
@ -92,7 +96,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;
|
||||
},
|
||||
|
||||
|
|
54
webapp/web/js/tiny_mce/themes/advanced/js/source_editor.js
vendored
Executable file → Normal file
54
webapp/web/js/tiny_mce/themes/advanced/js/source_editor.js
vendored
Executable file → Normal 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,10 +13,10 @@ 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');
|
||||
turnWrapOn();
|
||||
document.getElementById('wraped').checked = true;
|
||||
}
|
||||
|
||||
|
@ -37,26 +37,42 @@ function setWrap(val) {
|
|||
}
|
||||
}
|
||||
|
||||
function toggleWordWrap(elm) {
|
||||
if (elm.checked)
|
||||
setWrap('soft');
|
||||
else
|
||||
setWrap('off');
|
||||
function setWhiteSpaceCss(value) {
|
||||
var el = document.getElementById('htmlSource');
|
||||
tinymce.DOM.setStyle(el, 'white-space', value);
|
||||
}
|
||||
|
||||
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
|
||||
function turnWrapOff() {
|
||||
if (tinymce.isWebKit) {
|
||||
setWhiteSpaceCss('pre');
|
||||
} else {
|
||||
setWrap('off');
|
||||
}
|
||||
}
|
||||
|
||||
function turnWrapOn() {
|
||||
if (tinymce.isWebKit) {
|
||||
setWhiteSpaceCss('pre-wrap');
|
||||
} else {
|
||||
setWrap('soft');
|
||||
}
|
||||
}
|
||||
|
||||
function toggleWordWrap(elm) {
|
||||
if (elm.checked) {
|
||||
turnWrapOn();
|
||||
} else {
|
||||
turnWrapOff();
|
||||
}
|
||||
}
|
||||
|
||||
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';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue