author | Dan Fuhry <dan@enanocms.org> |
Thu, 28 Oct 2010 03:05:31 -0400 | |
changeset 1308 | f9bee9b125ee |
parent 1193 | e3b94bd055dc |
permissions | -rw-r--r-- |
1 | 1 |
/** |
1193 | 2 |
* $Id: editor_plugin_src.js 1222 2009-09-03 17:26:47Z spocke $ |
1 | 3 |
* |
4 |
* @author Moxiecode |
|
395
fa4c5ecb7c9a
Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents:
335
diff
changeset
|
5 |
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. |
1 | 6 |
*/ |
7 |
||
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
8 |
(function() { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
9 |
var each = tinymce.each; |
1 | 10 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
11 |
tinymce.create('tinymce.plugins.MediaPlugin', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
12 |
init : function(ed, url) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
13 |
var t = this; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
14 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
15 |
t.editor = ed; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
16 |
t.url = url; |
1 | 17 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
18 |
function isMediaElm(n) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
19 |
return /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
20 |
}; |
1 | 21 |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
22 |
ed.onPreInit.add(function() { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
23 |
// Force in _value parameter this extra parameter is required for older Opera versions |
778 | 24 |
ed.serializer.addRules('param[name|value|_mce_value]'); |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
25 |
}); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
26 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
27 |
// Register commands |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
28 |
ed.addCommand('mceMedia', function() { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
29 |
ed.windowManager.open({ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
30 |
file : url + '/media.htm', |
395
fa4c5ecb7c9a
Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents:
335
diff
changeset
|
31 |
width : 430 + parseInt(ed.getLang('media.delta_width', 0)), |
fa4c5ecb7c9a
Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents:
335
diff
changeset
|
32 |
height : 470 + parseInt(ed.getLang('media.delta_height', 0)), |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
33 |
inline : 1 |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
34 |
}, { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
35 |
plugin_url : url |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
36 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
37 |
}); |
1 | 38 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
39 |
// Register buttons |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
40 |
ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'}); |
1 | 41 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
42 |
ed.onNodeChange.add(function(ed, cm, n) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
43 |
cm.setActive('media', n.nodeName == 'IMG' && isMediaElm(n)); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
44 |
}); |
1 | 45 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
46 |
ed.onInit.add(function() { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
47 |
var lo = { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
48 |
mceItemFlash : 'flash', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
49 |
mceItemShockWave : 'shockwave', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
50 |
mceItemWindowsMedia : 'windowsmedia', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
51 |
mceItemQuickTime : 'quicktime', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
52 |
mceItemRealMedia : 'realmedia' |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
53 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
54 |
|
778 | 55 |
ed.selection.onSetContent.add(function() { |
56 |
t._spansToImgs(ed.getBody()); |
|
57 |
}); |
|
58 |
||
59 |
ed.selection.onBeforeSetContent.add(t._objectsToSpans, t); |
|
60 |
||
543 | 61 |
if (ed.settings.content_css !== false) |
62 |
ed.dom.loadCSS(url + "/css/content.css"); |
|
1 | 63 |
|
1193 | 64 |
if (ed.theme && ed.theme.onResolveName) { |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
65 |
ed.theme.onResolveName.add(function(th, o) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
66 |
if (o.name == 'img') { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
67 |
each(lo, function(v, k) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
68 |
if (ed.dom.hasClass(o.node, k)) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
69 |
o.name = v; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
70 |
o.title = ed.dom.getAttrib(o.node, 'title'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
71 |
return false; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
72 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
73 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
74 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
75 |
}); |
1 | 76 |
} |
77 |
||
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
78 |
if (ed && ed.plugins.contextmenu) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
79 |
ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
80 |
if (e.nodeName == 'IMG' && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
81 |
m.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
82 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
83 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
84 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
85 |
}); |
1 | 86 |
|
778 | 87 |
ed.onBeforeSetContent.add(t._objectsToSpans, t); |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
88 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
89 |
ed.onSetContent.add(function() { |
395
fa4c5ecb7c9a
Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents:
335
diff
changeset
|
90 |
t._spansToImgs(ed.getBody()); |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
91 |
}); |
1 | 92 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
93 |
ed.onPreProcess.add(function(ed, o) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
94 |
var dom = ed.dom; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
95 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
96 |
if (o.set) { |
395
fa4c5ecb7c9a
Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents:
335
diff
changeset
|
97 |
t._spansToImgs(o.node); |
1 | 98 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
99 |
each(dom.select('IMG', o.node), function(n) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
100 |
var p; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
101 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
102 |
if (isMediaElm(n)) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
103 |
p = t._parse(n.title); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
104 |
dom.setAttrib(n, 'width', dom.getAttrib(n, 'width', p.width || 100)); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
105 |
dom.setAttrib(n, 'height', dom.getAttrib(n, 'height', p.height || 100)); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
106 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
107 |
}); |
1 | 108 |
} |
109 |
||
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
110 |
if (o.get) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
111 |
each(dom.select('IMG', o.node), function(n) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
112 |
var ci, cb, mt; |
1 | 113 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
114 |
if (ed.getParam('media_use_script')) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
115 |
if (isMediaElm(n)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
116 |
n.className = n.className.replace(/mceItem/g, 'mceTemp'); |
1 | 117 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
118 |
return; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
119 |
} |
1 | 120 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
121 |
switch (n.className) { |
1 | 122 |
case 'mceItemFlash': |
123 |
ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000'; |
|
124 |
cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; |
|
125 |
mt = 'application/x-shockwave-flash'; |
|
126 |
break; |
|
127 |
||
128 |
case 'mceItemShockWave': |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
129 |
ci = '166b1bca-3f9c-11cf-8075-444553540000'; |
1 | 130 |
cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0'; |
131 |
mt = 'application/x-director'; |
|
132 |
break; |
|
133 |
||
134 |
case 'mceItemWindowsMedia': |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
135 |
ci = ed.getParam('media_wmp6_compatible') ? '05589fa1-c356-11ce-bf01-00aa0055595a' : '6bf52a52-394a-11d3-b153-00c04f79faa6'; |
1 | 136 |
cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; |
137 |
mt = 'application/x-mplayer2'; |
|
138 |
break; |
|
139 |
||
140 |
case 'mceItemQuickTime': |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
141 |
ci = '02bf25d5-8c17-4b23-bc80-d3488abddc6b'; |
1 | 142 |
cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'; |
143 |
mt = 'video/quicktime'; |
|
144 |
break; |
|
145 |
||
146 |
case 'mceItemRealMedia': |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
147 |
ci = 'cfcdaa03-8be4-11cf-b84b-0020afbbccfa'; |
1 | 148 |
cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; |
149 |
mt = 'audio/x-pn-realaudio-plugin'; |
|
150 |
break; |
|
151 |
} |
|
152 |
||
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
153 |
if (ci) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
154 |
dom.replace(t._buildObj({ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
155 |
classid : ci, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
156 |
codebase : cb, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
157 |
type : mt |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
158 |
}, n), n); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
159 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
160 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
161 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
162 |
}); |
1 | 163 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
164 |
ed.onPostProcess.add(function(ed, o) { |
778 | 165 |
o.content = o.content.replace(/_mce_value=/g, 'value='); |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
166 |
}); |
1 | 167 |
|
1193 | 168 |
function getAttr(s, n) { |
169 |
n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s); |
|
1 | 170 |
|
1193 | 171 |
return n ? ed.dom.decode(n[1]) : ''; |
172 |
}; |
|
1 | 173 |
|
1193 | 174 |
ed.onPostProcess.add(function(ed, o) { |
175 |
if (ed.getParam('media_use_script')) { |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
176 |
o.content = o.content.replace(/<img[^>]+>/g, function(im) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
177 |
var cl = getAttr(im, 'class'); |
1 | 178 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
179 |
if (/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
180 |
at = t._parse(getAttr(im, 'title')); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
181 |
at.width = getAttr(im, 'width'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
182 |
at.height = getAttr(im, 'height'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
183 |
im = '<script type="text/javascript">write' + cl.substring(7) + '({' + t._serialize(at) + '});</script>'; |
1 | 184 |
} |
185 |
||
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
186 |
return im; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
187 |
}); |
1193 | 188 |
} |
189 |
}); |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
190 |
}, |
1 | 191 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
192 |
getInfo : function() { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
193 |
return { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
194 |
longname : 'Media', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
195 |
author : 'Moxiecode Systems AB', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
196 |
authorurl : 'http://tinymce.moxiecode.com', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
197 |
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
198 |
version : tinymce.majorVersion + "." + tinymce.minorVersion |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
199 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
200 |
}, |
1 | 201 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
202 |
// Private methods |
778 | 203 |
_objectsToSpans : function(ed, o) { |
204 |
var t = this, h = o.content; |
|
205 |
||
206 |
h = h.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, function(a, b, c) { |
|
207 |
var o = t._parse(c); |
|
208 |
||
209 |
return '<img class="mceItem' + b + '" title="' + ed.dom.encode(c) + '" src="' + t.url + '/img/trans.gif" width="' + o.width + '" height="' + o.height + '" />' |
|
210 |
}); |
|
211 |
||
212 |
h = h.replace(/<object([^>]*)>/gi, '<span class="mceItemObject" $1>'); |
|
213 |
h = h.replace(/<embed([^>]*)\/?>/gi, '<span class="mceItemEmbed" $1></span>'); |
|
214 |
h = h.replace(/<embed([^>]*)>/gi, '<span class="mceItemEmbed" $1>'); |
|
215 |
h = h.replace(/<\/(object)([^>]*)>/gi, '</span>'); |
|
216 |
h = h.replace(/<\/embed>/gi, ''); |
|
217 |
h = h.replace(/<param([^>]*)>/gi, function(a, b) {return '<span ' + b.replace(/value=/gi, '_mce_value=') + ' class="mceItemParam"></span>'}); |
|
218 |
h = h.replace(/\/ class=\"mceItemParam\"><\/span>/gi, 'class="mceItemParam"></span>'); |
|
219 |
||
220 |
o.content = h; |
|
221 |
}, |
|
1 | 222 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
223 |
_buildObj : function(o, n) { |
778 | 224 |
var ob, ed = this.editor, dom = ed.dom, p = this._parse(n.title), stc; |
225 |
||
226 |
stc = ed.getParam('media_strict', true) && o.type == 'application/x-shockwave-flash'; |
|
1 | 227 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
228 |
p.width = o.width = dom.getAttrib(n, 'width') || 100; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
229 |
p.height = o.height = dom.getAttrib(n, 'height') || 100; |
1 | 230 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
231 |
if (p.src) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
232 |
p.src = ed.convertURL(p.src, 'src', n); |
1 | 233 |
|
778 | 234 |
if (stc) { |
235 |
ob = dom.create('span', { |
|
1193 | 236 |
id : p.id, |
778 | 237 |
mce_name : 'object', |
238 |
type : 'application/x-shockwave-flash', |
|
239 |
data : p.src, |
|
1193 | 240 |
style : dom.getAttrib(n, 'style'), |
778 | 241 |
width : o.width, |
242 |
height : o.height |
|
243 |
}); |
|
244 |
} else { |
|
245 |
ob = dom.create('span', { |
|
1193 | 246 |
id : p.id, |
778 | 247 |
mce_name : 'object', |
248 |
classid : "clsid:" + o.classid, |
|
1193 | 249 |
style : dom.getAttrib(n, 'style'), |
778 | 250 |
codebase : o.codebase, |
251 |
width : o.width, |
|
252 |
height : o.height |
|
253 |
}); |
|
254 |
} |
|
255 |
||
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
256 |
each (p, function(v, k) { |
1193 | 257 |
if (!/^(width|height|codebase|classid|id|_cx|_cy)$/.test(k)) { |
543 | 258 |
// Use url instead of src in IE for Windows media |
1193 | 259 |
if (o.type == 'application/x-mplayer2' && k == 'src' && !p.url) |
543 | 260 |
k = 'url'; |
261 |
||
778 | 262 |
if (v) |
263 |
dom.add(ob, 'span', {mce_name : 'param', name : k, '_mce_value' : v}); |
|
543 | 264 |
} |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
265 |
}); |
1 | 266 |
|
778 | 267 |
if (!stc) |
1193 | 268 |
dom.add(ob, 'span', tinymce.extend({mce_name : 'embed', type : o.type, style : dom.getAttrib(n, 'style')}, p)); |
1 | 269 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
270 |
return ob; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
271 |
}, |
1 | 272 |
|
395
fa4c5ecb7c9a
Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents:
335
diff
changeset
|
273 |
_spansToImgs : function(p) { |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
274 |
var t = this, dom = t.editor.dom, im, ci; |
1 | 275 |
|
395
fa4c5ecb7c9a
Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents:
335
diff
changeset
|
276 |
each(dom.select('span', p), function(n) { |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
277 |
// Convert object into image |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
278 |
if (dom.getAttrib(n, 'class') == 'mceItemObject') { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
279 |
ci = dom.getAttrib(n, "classid").toLowerCase().replace(/\s+/g, ''); |
1 | 280 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
281 |
switch (ci) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
282 |
case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
283 |
dom.replace(t._createImg('mceItemFlash', n), n); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
284 |
break; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
285 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
286 |
case 'clsid:166b1bca-3f9c-11cf-8075-444553540000': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
287 |
dom.replace(t._createImg('mceItemShockWave', n), n); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
288 |
break; |
1 | 289 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
290 |
case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
291 |
case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
292 |
case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
293 |
dom.replace(t._createImg('mceItemWindowsMedia', n), n); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
294 |
break; |
1 | 295 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
296 |
case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
297 |
dom.replace(t._createImg('mceItemQuickTime', n), n); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
298 |
break; |
1 | 299 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
300 |
case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
301 |
dom.replace(t._createImg('mceItemRealMedia', n), n); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
302 |
break; |
1 | 303 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
304 |
default: |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
305 |
dom.replace(t._createImg('mceItemFlash', n), n); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
306 |
} |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
307 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
308 |
return; |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
309 |
} |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
310 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
311 |
// Convert embed into image |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
312 |
if (dom.getAttrib(n, 'class') == 'mceItemEmbed') { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
313 |
switch (dom.getAttrib(n, 'type')) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
314 |
case 'application/x-shockwave-flash': |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
315 |
dom.replace(t._createImg('mceItemFlash', n), n); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
316 |
break; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
317 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
318 |
case 'application/x-director': |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
319 |
dom.replace(t._createImg('mceItemShockWave', n), n); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
320 |
break; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
321 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
322 |
case 'application/x-mplayer2': |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
323 |
dom.replace(t._createImg('mceItemWindowsMedia', n), n); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
324 |
break; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
325 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
326 |
case 'video/quicktime': |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
327 |
dom.replace(t._createImg('mceItemQuickTime', n), n); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
328 |
break; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
329 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
330 |
case 'audio/x-pn-realaudio-plugin': |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
331 |
dom.replace(t._createImg('mceItemRealMedia', n), n); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
332 |
break; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
333 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
334 |
default: |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
335 |
dom.replace(t._createImg('mceItemFlash', n), n); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
336 |
} |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
337 |
} |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
338 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
339 |
}, |
1 | 340 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
341 |
_createImg : function(cl, n) { |
778 | 342 |
var im, dom = this.editor.dom, pa = {}, ti = '', args; |
343 |
||
1193 | 344 |
args = ['id', 'name', 'width', 'height', 'bgcolor', 'align', 'flashvars', 'src', 'wmode', 'allowfullscreen', 'quality', 'data']; |
1 | 345 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
346 |
// Create image |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
347 |
im = dom.create('img', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
348 |
src : this.url + '/img/trans.gif', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
349 |
width : dom.getAttrib(n, 'width') || 100, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
350 |
height : dom.getAttrib(n, 'height') || 100, |
1193 | 351 |
style : dom.getAttrib(n, 'style'), |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
352 |
'class' : cl |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
353 |
}); |
1 | 354 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
355 |
// Setup base parameters |
778 | 356 |
each(args, function(na) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
357 |
var v = dom.getAttrib(n, na); |
1 | 358 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
359 |
if (v) |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
360 |
pa[na] = v; |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
361 |
}); |
1 | 362 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
363 |
// Add optional parameters |
395
fa4c5ecb7c9a
Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents:
335
diff
changeset
|
364 |
each(dom.select('span', n), function(n) { |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
365 |
if (dom.hasClass(n, 'mceItemParam')) |
778 | 366 |
pa[dom.getAttrib(n, 'name')] = dom.getAttrib(n, '_mce_value'); |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
367 |
}); |
1 | 368 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
369 |
// Use src not movie |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
370 |
if (pa.movie) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
371 |
pa.src = pa.movie; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
372 |
delete pa.movie; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
373 |
} |
1 | 374 |
|
1193 | 375 |
// No src try data |
376 |
if (!pa.src) { |
|
377 |
pa.src = pa.data; |
|
378 |
delete pa.data; |
|
379 |
} |
|
380 |
||
778 | 381 |
// Merge with embed args |
382 |
n = dom.select('.mceItemEmbed', n)[0]; |
|
383 |
if (n) { |
|
384 |
each(args, function(na) { |
|
385 |
var v = dom.getAttrib(n, na); |
|
386 |
||
387 |
if (v && !pa[na]) |
|
388 |
pa[na] = v; |
|
389 |
}); |
|
390 |
} |
|
391 |
||
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
392 |
delete pa.width; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
393 |
delete pa.height; |
1 | 394 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
395 |
im.title = this._serialize(pa); |
1 | 396 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
397 |
return im; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
398 |
}, |
1 | 399 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
400 |
_parse : function(s) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
401 |
return tinymce.util.JSON.parse('{' + s + '}'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
402 |
}, |
1 | 403 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
404 |
_serialize : function(o) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
405 |
return tinymce.util.JSON.serialize(o).replace(/[{}]/g, ''); |
1 | 406 |
} |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
407 |
}); |
1 | 408 |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
409 |
// Register plugin |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
410 |
tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
1
diff
changeset
|
411 |
})(); |