TinyMCE 4.0.12, first run.

- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876


git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2013-12-28 23:53:15 +00:00
parent f3b433cec3
commit 855889f7aa
232 changed files with 43190 additions and 18563 deletions

View File

@ -4315,7 +4315,7 @@ td.plugin-title p {
}
.autosave-info {
padding: 2px 15px;
padding: 2px;
text-align: left;
}
@ -4323,43 +4323,20 @@ td.plugin-title p {
border: none;
}
#content-resize-handle,
#post-body .wp_themeSkin .mceStatusbar a.mceResize {
#content-resize-handle {
background: transparent url('../images/resize.gif') no-repeat scroll left bottom;
width: 12px;
height: 12px;
cursor: sw-resize;
cursor: n-resize;
}
.rtl #content-resize-handle,
.rtl #post-body .wp_themeSkin .mceStatusbar a.mceResize {
background: transparent url('../images/resize-rtl.gif') no-repeat scroll left bottom;
}
#post-body .wp_themeSkin .mceStatusbar a.mceResize {
bottom: 3px;
position: absolute;
left: 3px;
}
#post-body .postarea .wp_themeSkin .mceStatusbar a.mceResize {
bottom: -20px;
}
#content-resize-handle {
position: absolute;
left: 3px;
bottom: -20px;
.rtl #content-resize-handle {
background: transparent url('../images/resize-rtl.gif') no-repeat scroll right bottom;
}
.press-this #content-resize-handle {
bottom: 2px;
}
.tmce-active #content-resize-handle {
display: none;
}
#wp-word-count {
display: block;
padding: 2px 10px;

File diff suppressed because one or more lines are too long

View File

@ -4315,7 +4315,7 @@ td.plugin-title p {
}
.autosave-info {
padding: 2px 15px;
padding: 2px;
text-align: right;
}
@ -4323,43 +4323,20 @@ td.plugin-title p {
border: none;
}
#content-resize-handle,
#post-body .wp_themeSkin .mceStatusbar a.mceResize {
#content-resize-handle {
background: transparent url('../images/resize.gif') no-repeat scroll right bottom;
width: 12px;
height: 12px;
cursor: se-resize;
cursor: n-resize;
}
.rtl #content-resize-handle,
.rtl #post-body .wp_themeSkin .mceStatusbar a.mceResize {
background: transparent url('../images/resize-rtl.gif') no-repeat scroll right bottom;
}
#post-body .wp_themeSkin .mceStatusbar a.mceResize {
bottom: 3px;
position: absolute;
right: 3px;
}
#post-body .postarea .wp_themeSkin .mceStatusbar a.mceResize {
bottom: -20px;
}
#content-resize-handle {
position: absolute;
right: 3px;
bottom: -20px;
.rtl #content-resize-handle {
background: transparent url('../images/resize-rtl.gif') no-repeat scroll left bottom;
}
.press-this #content-resize-handle {
bottom: 2px;
}
.tmce-active #content-resize-handle {
display: none;
}
#wp-word-count {
display: block;
padding: 2px 10px;

File diff suppressed because one or more lines are too long

View File

@ -483,6 +483,9 @@ if ( post_type_supports($post_type, 'editor') ) {
'dfw' => true,
'tabfocus_elements' => 'insert-media-button,save-post',
'editor_height' => 360,
'tinymce' => array(
'resize' => false,
),
) ); ?>
<table id="post-status-info" cellspacing="0"><tbody><tr>
<td id="wp-word-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td>
@ -499,6 +502,7 @@ if ( post_type_supports($post_type, 'editor') ) {
echo '</span>';
} ?>
</td>
<td id="content-resize-handle" class="hide-if-no-js"><br /></td>
</tr></tbody></table>
</div>

View File

@ -1787,16 +1787,8 @@ function wp_ajax_wp_fullscreen_save_post() {
$post_id = edit_post();
if ( is_wp_error($post_id) ) {
if ( $post_id->get_error_message() )
$message = $post_id->get_error_message();
else
$message = __('Save failed');
echo json_encode( array( 'message' => $message, 'last_edited' => '' ) );
wp_die();
} else {
$message = __('Saved.');
if ( is_wp_error( $post_id ) ) {
wp_send_json_error();
}
if ( $post ) {
@ -1807,15 +1799,14 @@ function wp_ajax_wp_fullscreen_save_post() {
$last_time = date_i18n( get_option('time_format') );
}
if ( $last_id = get_post_meta($post_id, '_edit_last', true) ) {
$last_user = get_userdata($last_id);
if ( $last_id = get_post_meta( $post_id, '_edit_last', true ) ) {
$last_user = get_userdata( $last_id );
$last_edited = sprintf( __('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), $last_date, $last_time );
} else {
$last_edited = sprintf( __('Last edited on %1$s at %2$s'), $last_date, $last_time );
}
echo json_encode( array( 'message' => $message, 'last_edited' => $last_edited ) );
wp_die();
wp_send_json_success( array( 'last_edited' => $last_edited ) );
}
function wp_ajax_wp_remove_post_lock() {
@ -1839,9 +1830,9 @@ function wp_ajax_wp_remove_post_lock() {
*
* @since 3.3.0
*
* @param int $interval The interval in seconds the post lock duration should last, plus 5 seconds. Default 120.
* @param int $interval The interval in seconds the post lock duration should last, plus 5 seconds. Default 150.
*/
$new_lock = ( time() - apply_filters( 'wp_check_post_lock_window', 120 ) + 5 ) . ':' . $active_lock[1];
$new_lock = ( time() - apply_filters( 'wp_check_post_lock_window', 150 ) + 5 ) . ':' . $active_lock[1];
update_post_meta( $post_id, '_edit_lock', $new_lock, implode( ':', $active_lock ) );
wp_die( 1 );
}

View File

@ -13,15 +13,15 @@ window.switchEditors = {
// mode can be 'html', 'tmce', or 'toggle'; 'html' is used for the 'Text' editor tab.
go: function( id, mode ) {
var t = this, ed, wrap_id, txtarea_el,
dom = tinymce.DOM;
var t = this, ed, wrap_id, txtarea_el, editorHeight, toolbarHeight,
DOM = tinymce.DOM; //DOMUtils outside the editor iframe
id = id || 'content';
mode = mode || 'toggle';
ed = tinymce.get( id );
wrap_id = 'wp-' + id + '-wrap';
txtarea_el = dom.get( id );
txtarea_el = DOM.get( id );
if ( 'toggle' === mode ) {
if ( ed && ! ed.isHidden() ) {
@ -31,6 +31,20 @@ window.switchEditors = {
}
}
function getToolbarHeight() {
var height;
try {
height = DOM.getSize( DOM.select( '.mce-toolbar-grp', ed.getContainer() )[0] );
} catch(e){}
if ( height && height.h && height.h > 10 && height.h < 100 ) {
return height.h;
}
return 0;
}
if ( 'tmce' === mode || 'tinymce' === mode ) {
if ( ed && ! ed.isHidden() ) {
return false;
@ -40,19 +54,32 @@ window.switchEditors = {
QTags.closeAllTags( id );
}
editorHeight = txtarea_el ? parseInt( txtarea_el.style.height, 10 ) : 0;
if ( tinyMCEPreInit.mceInit[ id ] && tinyMCEPreInit.mceInit[ id ].wpautop ) {
txtarea_el.value = t.wpautop( txtarea_el.value );
}
if ( ed ) {
ed.show();
if ( editorHeight && ( toolbarHeight = getToolbarHeight() ) ) {
editorHeight = editorHeight - toolbarHeight + 11;
// height cannot be under 50 or over 5000
if ( editorHeight > 50 && editorHeight < 5000 ) {
ed.theme.resizeTo( null, editorHeight );
}
}
} else {
ed = new tinymce.Editor( id, tinyMCEPreInit.mceInit[ id ] );
ed.render();
tinymce.init( tinyMCEPreInit.mceInit[id] );
// ed = tinymce.createEditor( id, tinyMCEPreInit.mceInit[id] );
// ed.render();
}
dom.removeClass( wrap_id, 'html-active' );
dom.addClass( wrap_id, 'tmce-active' );
DOM.removeClass( wrap_id, 'html-active' );
DOM.addClass( wrap_id, 'tmce-active' );
setUserSetting( 'editor', 'tinymce' );
} else if ( 'html' === mode ) {
@ -62,6 +89,18 @@ window.switchEditors = {
}
if ( ed ) {
editorHeight = DOM.get( id + '_ifr' );
editorHeight = editorHeight ? parseInt( editorHeight.style.height, 10 ) : 0;
if ( editorHeight && ( toolbarHeight = getToolbarHeight() ) ) {
editorHeight = editorHeight + toolbarHeight - 11;
// height cannot be under 50 or over 5000
if ( editorHeight > 50 && editorHeight < 5000 ) {
txtarea_el.style.height = editorHeight + 'px';
}
}
ed.hide();
} else {
// The TinyMCE instance doesn't exist, run the content through 'pre_wpautop()' and show the textarea
@ -69,11 +108,11 @@ window.switchEditors = {
txtarea_el.value = t.pre_wpautop( txtarea_el.value );
}
dom.setStyles( txtarea_el, {'display': '', 'visibility': ''} );
DOM.setStyles( txtarea_el, {'display': '', 'visibility': ''} );
}
dom.removeClass( wrap_id, 'tmce-active' );
dom.addClass( wrap_id, 'html-active' );
DOM.removeClass( wrap_id, 'tmce-active' );
DOM.addClass( wrap_id, 'html-active' );
setUserSetting( 'editor', 'html' );
}
return false;
@ -88,8 +127,9 @@ window.switchEditors = {
if ( content.indexOf( '<pre' ) !== -1 || content.indexOf( '<script' ) !== -1 ) {
preserve_linebreaks = true;
content = content.replace( /<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function( a ) {
a = a.replace( /<br ?\/?>(\r\n|\n)?/g, '<wp-temp-lb>' );
return a.replace( /<\/?p( [^>]*)?>(\r\n|\n)?/g, '<wp-temp-lb>' );
a = a.replace( /<br ?\/?>(\r\n|\n)?/g, '<wp-line-break>' );
a = a.replace( /<\/?p( [^>]*)?>(\r\n|\n)?/g, '<wp-line-break>' );
return a.replace( /\r?\n/g, '<wp-line-break>' );
});
}
@ -149,7 +189,7 @@ window.switchEditors = {
// put back the line breaks in pre|script
if ( preserve_linebreaks ) {
content = content.replace( /<wp-temp-lb>/g, '\n' );
content = content.replace( /<wp-line-break>/g, '\n' );
}
// and the <br> tags in captions
@ -181,7 +221,7 @@ window.switchEditors = {
if ( pee.indexOf( '<pre' ) !== -1 || pee.indexOf( '<script' ) !== -1 ) {
preserve_linebreaks = true;
pee = pee.replace( /<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function( a ) {
return a.replace( /(\r\n|\n)/g, '<wp-temp-lb>' );
return a.replace( /(\r\n|\n)/g, '<wp-line-break>' );
});
}
@ -230,7 +270,7 @@ window.switchEditors = {
// put back the line breaks in pre|script
if ( preserve_linebreaks ) {
pee = pee.replace( /<wp-temp-lb>/g, '\n' );
pee = pee.replace( /<wp-line-break>/g, '\n' );
}
if ( preserve_br ) {

File diff suppressed because one or more lines are too long

View File

@ -6,24 +6,21 @@ var wpActiveEditor, send_to_editor;
send_to_editor = function(h) {
var ed, mce = typeof(tinymce) != 'undefined', qt = typeof(QTags) != 'undefined';
if ( !wpActiveEditor ) {
if ( ! wpActiveEditor ) {
if ( mce && tinymce.activeEditor ) {
ed = tinymce.activeEditor;
wpActiveEditor = ed.id;
} else if ( !qt ) {
} else if ( ! qt ) {
return false;
}
} else if ( mce ) {
if ( tinymce.activeEditor && (tinymce.activeEditor.id == 'mce_fullscreen' || tinymce.activeEditor.id == 'wp_mce_fullscreen') )
ed = tinymce.activeEditor;
else
ed = tinymce.get(wpActiveEditor);
ed = tinymce.get( wpActiveEditor );
}
if ( ed && !ed.isHidden() ) {
if ( ed && ! ed.isHidden() ) {
// restore caret position on IE
if ( tinymce.isIE && ed.windowManager.insertimagebookmark )
ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark);
// if ( tinymce.isIE && ed.windowManager.insertimagebookmark )
// ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark);
if ( h.indexOf('[caption') !== -1 ) {
if ( ed.wpSetImgCaption )
@ -78,7 +75,7 @@ var tb_position;
};
$(window).resize(function(){ tb_position(); });
/*
// store caret position in IE
$(document).ready(function($){
$('a.thickbox').click(function(){
@ -90,5 +87,5 @@ var tb_position;
}
});
});
*/
})(jQuery);

View File

@ -1 +1 @@
var wpActiveEditor,send_to_editor;send_to_editor=function(a){var b,c="undefined"!=typeof tinymce,d="undefined"!=typeof QTags;if(wpActiveEditor)c&&(b=!tinymce.activeEditor||"mce_fullscreen"!=tinymce.activeEditor.id&&"wp_mce_fullscreen"!=tinymce.activeEditor.id?tinymce.get(wpActiveEditor):tinymce.activeEditor);else if(c&&tinymce.activeEditor)b=tinymce.activeEditor,wpActiveEditor=b.id;else if(!d)return!1;b&&!b.isHidden()?(tinymce.isIE&&b.windowManager.insertimagebookmark&&b.selection.moveToBookmark(b.windowManager.insertimagebookmark),-1!==a.indexOf("[caption")?b.wpSetImgCaption&&(a=b.wpSetImgCaption(a)):-1!==a.indexOf("[gallery")?b.plugins.wpgallery&&(a=b.plugins.wpgallery._do_gallery(a)):0===a.indexOf("[embed")&&b.plugins.wordpress&&(a=b.plugins.wordpress._setEmbed(a)),b.execCommand("mceInsertContent",!1,a)):d?QTags.insertContent(a):document.getElementById(wpActiveEditor).value+=a;try{tb_remove()}catch(e){}};var tb_position;!function(a){tb_position=function(){var b=a("#TB_window"),c=a(window).width(),d=a(window).height(),e=c>720?720:c,f=0;return a("body.admin-bar").length&&(f=parseInt(jQuery("#wpadminbar").css("height"),10)),b.size()&&(b.width(e-50).height(d-45-f),a("#TB_iframeContent").width(e-50).height(d-75-f),b.css({"margin-left":"-"+parseInt((e-50)/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&b.css({top:20+f+"px","margin-top":"0"})),a("a.thickbox").each(function(){var b=a(this).attr("href");b&&(b=b.replace(/&width=[0-9]+/g,""),b=b.replace(/&height=[0-9]+/g,""),a(this).attr("href",b+"&width="+(e-80)+"&height="+(d-85-f)))})},a(window).resize(function(){tb_position()}),a(document).ready(function(a){a("a.thickbox").click(function(){var a;"undefined"!=typeof tinymce&&tinymce.isIE&&(a=tinymce.get(wpActiveEditor))&&!a.isHidden()&&(a.focus(),a.windowManager.insertimagebookmark=a.selection.getBookmark())})})}(jQuery);
var wpActiveEditor,send_to_editor;send_to_editor=function(a){var b,c="undefined"!=typeof tinymce,d="undefined"!=typeof QTags;if(wpActiveEditor)c&&(b=tinymce.get(wpActiveEditor));else if(c&&tinymce.activeEditor)b=tinymce.activeEditor,wpActiveEditor=b.id;else if(!d)return!1;b&&!b.isHidden()?(-1!==a.indexOf("[caption")?b.wpSetImgCaption&&(a=b.wpSetImgCaption(a)):-1!==a.indexOf("[gallery")?b.plugins.wpgallery&&(a=b.plugins.wpgallery._do_gallery(a)):0===a.indexOf("[embed")&&b.plugins.wordpress&&(a=b.plugins.wordpress._setEmbed(a)),b.execCommand("mceInsertContent",!1,a)):d?QTags.insertContent(a):document.getElementById(wpActiveEditor).value+=a;try{tb_remove()}catch(e){}};var tb_position;!function(a){tb_position=function(){var b=a("#TB_window"),c=a(window).width(),d=a(window).height(),e=c>720?720:c,f=0;return a("body.admin-bar").length&&(f=parseInt(jQuery("#wpadminbar").css("height"),10)),b.size()&&(b.width(e-50).height(d-45-f),a("#TB_iframeContent").width(e-50).height(d-75-f),b.css({"margin-left":"-"+parseInt((e-50)/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&b.css({top:20+f+"px","margin-top":"0"})),a("a.thickbox").each(function(){var b=a(this).attr("href");b&&(b=b.replace(/&width=[0-9]+/g,""),b=b.replace(/&height=[0-9]+/g,""),a(this).attr("href",b+"&width="+(e-80)+"&height="+(d-85-f)))})},a(window).resize(function(){tb_position()})}(jQuery);

View File

@ -812,114 +812,72 @@ jQuery(document).ready( function($) {
wptitlehint();
// resizable textarea#content
(function() {
var textarea = $('textarea#content'), offset = null, el;
// Resize the visual and text editors
( function() {
var editor, offset, mce,
$document = $( document ),
$textarea = $('textarea#content'),
$handle = $('#post-status-info');
// No point for touch devices
if ( !textarea.length || 'ontouchstart' in window )
if ( ! $textarea.length || 'ontouchstart' in window ) {
return;
}
function dragging(e) {
textarea.height( Math.max(50, offset + e.pageY) + 'px' );
return false;
function dragging( event ) {
if ( mce ) {
editor.theme.resizeTo( null, offset + event.pageY );
} else {
$textarea.height( Math.max( 50, offset + event.pageY ) );
}
event.preventDefault();
}
function endDrag() {
var height;
var height, toolbarHeight;
textarea.focus();
$(document).unbind('mousemove', dragging).unbind('mouseup', endDrag);
if ( mce ) {
editor.focus();
toolbarHeight = $( '#wp-content-editor-container .mce-toolbar-grp' ).height();
height = parseInt( $('#content_ifr').css('height'), 10 ) + toolbarHeight - 28;
} else {
$textarea.focus();
height = parseInt( $textarea.css('height'), 10 );
}
height = parseInt( textarea.css('height'), 10 );
$document.off( 'mousemove.wp-editor-resize mouseup.wp-editor-resize' );
// sanity check
if ( height && height > 50 && height < 5000 )
if ( height && height > 50 && height < 5000 ) {
setUserSetting( 'ed_size', height );
}
}
textarea.css('resize', 'none');
el = $('<div id="content-resize-handle"><br></div>');
$('#wp-content-wrap').append(el);
el.on('mousedown', function(e) {
offset = textarea.height() - e.pageY;
textarea.blur();
$(document).mousemove(dragging).mouseup(endDrag);
return false;
$textarea.css( 'resize', 'none' );
$handle.on( 'mousedown.wp-editor-resize', function( event ) {
if ( typeof tinymce !== 'undefined' ) {
editor = tinymce.get('content');
}
if ( editor && ! editor.isHidden() ) {
mce = true;
offset = $('#content_ifr').height() - event.pageY;
} else {
mce = false;
offset = $textarea.height() - event.pageY;
$textarea.blur();
}
$document.on( 'mousemove.wp-editor-resize', dragging )
.on( 'mouseup.wp-editor-resize', endDrag );
event.preventDefault();
});
})();
if ( typeof(tinymce) != 'undefined' ) {
tinymce.onAddEditor.add(function(mce, ed){
// iOS expands the iframe to full height and the user cannot adjust it.
if ( ed.id != 'content' || tinymce.isIOS5 )
return;
function getHeight() {
var height, node = document.getElementById('content_ifr'),
ifr_height = node ? parseInt( node.style.height, 10 ) : 0,
tb_height = $('#content_tbl tr.mceFirst').height();
if ( !ifr_height || !tb_height )
return false;
// total height including toolbar and statusbar
height = ifr_height + tb_height + 21;
// textarea height = total height - 33px toolbar
height -= 33;
return height;
}
// resize TinyMCE to match the textarea height when switching Text -> Visual
ed.onLoadContent.add( function() {
var ifr_height, node = document.getElementById('content'),
height = node ? parseInt( node.style.height, 10 ) : 0,
tb_height = $('#content_tbl tr.mceFirst').height() || 33;
// height cannot be under 50 or over 5000
if ( !height || height < 50 || height > 5000 )
height = 360; // default height for the main editor
if ( getUserSetting( 'ed_size' ) > 5000 )
setUserSetting( 'ed_size', 360 );
// compensate for padding and toolbars
ifr_height = ( height - tb_height ) + 12;
// sanity check
if ( ifr_height > 50 && ifr_height < 5000 ) {
$('#content_tbl').css('height', '' );
$('#content_ifr').css('height', ifr_height + 'px' );
}
});
// resize the textarea to match TinyMCE's height when switching Visual -> Text
ed.onSaveContent.add( function() {
var height = getHeight();
if ( !height || height < 50 || height > 5000 )
return;
$('textarea#content').css( 'height', height + 'px' );
});
// save on resizing TinyMCE
ed.onPostRender.add(function() {
$( '#content_resize' ).on( 'mousedown.wp-mce-resize', function() {
$( document ).on( 'mouseup.wp-mce-resize', function() {
var height;
$(document).off('mouseup.wp-mce-resize');
height = getHeight();
// sanity check
if ( height && height > 50 && height < 5000 )
setUserSetting( 'ed_size', height );
});
});
});
});
if ( typeof tinymce !== 'undefined' ) {
// When changing post formats, change the editor body class
$( '#post-formats-select input.post-format' ).on( 'change.set-editor-class', function() {
var editor, body, format = this.id;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -189,46 +189,71 @@ final class _WP_Editors {
if ( self::$this_tinymce ) {
if ( empty(self::$first_init) ) {
self::$baseurl = includes_url('js/tinymce');
self::$mce_locale = $mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1
if ( empty( self::$first_init ) ) {
self::$baseurl = includes_url( 'js/tinymce' );
$mce_locale = get_locale();
if ( empty( $mce_locale ) || 'en' == substr( $mce_locale, 0, 2 ) ) {
$mce_locale = 'en';
}
self::$mce_locale = $mce_locale;
$no_captions = (bool) apply_filters( 'disable_captions', '' );
$plugins = array( 'inlinepopups', 'tabfocus', 'paste', 'media', 'fullscreen', 'wordpress', 'wpeditimage', 'wpgallery', 'wplink', 'wpdialogs' );
$first_run = true;
$ext_plugins = '';
if ( $set['teeny'] ) {
self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array('inlinepopups', 'fullscreen', 'wordpress', 'wplink', 'wpdialogs' ), $editor_id );
self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array( 'fullscreen', 'link', 'image', 'wordpress', 'wplink' ), $editor_id );
} else {
/*
The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
It adds the plugin's name to TinyMCE's plugins init and the call to PluginManager to load the plugin.
The url should be absolute and should include the js file name to be loaded. Example:
array( 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js' )
If the plugin uses a button, it should be added with one of the "$mce_buttons" filters.
*/
$mce_external_plugins = apply_filters('mce_external_plugins', array());
/**
* TinyMCE external plugins filter
*
* Takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
* The url should be absolute and should include the js file name to be loaded.
* Example: 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js'.
* If the plugin adds a button, it should be added with one of the "$mce_buttons" filters.
*/
$mce_external_plugins = apply_filters( 'mce_external_plugins', array() );
if ( ! empty($mce_external_plugins) ) {
/**
* TinyMCE default plugins filter
*
* Specifies which of the default plugins that are included in WordPress should be added to
* the TinyMCE instance.
*/
$plugins = array_unique( apply_filters( 'tiny_mce_plugins', array(
'charmap',
'link',
'media',
'paste',
'tabfocus',
'textcolor',
'image',
'fullscreen',
'wordpress',
'wpeditimage',
'wpgallery',
'wplink',
) ) );
/*
The following filter loads external language files for TinyMCE plugins.
It takes an associative array 'plugin_name' => 'path', where path is the
include path to the file. The language file should follow the same format as
/tinymce/langs/wp-langs.php and should define a variable $strings that
holds all translated strings.
When this filter is not used, the function will try to load {mce_locale}.js.
If that is not found, en.js will be tried next.
*/
$mce_external_languages = apply_filters('mce_external_languages', array());
if ( ! empty( $mce_external_plugins ) ) {
/**
* This filter loads translations for external TinyMCE 3.x plugins.
*
* Takes an associative array 'plugin_name' => 'path', where path is the
* include path to the file. The language file should follow the same format as
* wp_mce_translation() and should define a variable $strings that
* holds all translated strings.
*/
$mce_external_languages = apply_filters( 'mce_external_languages', array() );
$loaded_langs = array();
$strings = '';
if ( ! empty($mce_external_languages) ) {
if ( ! empty( $mce_external_languages ) ) {
foreach ( $mce_external_languages as $name => $path ) {
if ( @is_file($path) && @is_readable($path) ) {
include_once($path);
if ( @is_file( $path ) && @is_readable( $path ) ) {
include_once( $path );
$ext_plugins .= $strings . "\n";
$loaded_langs[] = $name;
}
@ -236,48 +261,20 @@ final class _WP_Editors {
}
foreach ( $mce_external_plugins as $name => $url ) {
$url = set_url_scheme( $url );
$plugins[] = '-' . $name;
$plugurl = dirname($url);
$strings = $str1 = $str2 = '';
if ( ! in_array($name, $loaded_langs) ) {
$path = str_replace( content_url(), '', $plugurl );
$path = WP_CONTENT_DIR . $path . '/langs/';
if ( function_exists('realpath') )
$path = trailingslashit( realpath($path) );
if ( @is_file($path . $mce_locale . '.js') )
$strings .= @file_get_contents($path . $mce_locale . '.js') . "\n";
if ( @is_file($path . $mce_locale . '_dlg.js') )
$strings .= @file_get_contents($path . $mce_locale . '_dlg.js') . "\n";
if ( 'en' != $mce_locale && empty($strings) ) {
if ( @is_file($path . 'en.js') ) {
$str1 = @file_get_contents($path . 'en.js');
$strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str1, 1 ) . "\n";
}
if ( @is_file($path . 'en_dlg.js') ) {
$str2 = @file_get_contents($path . 'en_dlg.js');
$strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str2, 1 ) . "\n";
}
}
if ( ! empty($strings) )
$ext_plugins .= "\n" . $strings . "\n";
if ( in_array( $name, $plugins, true ) ) {
unset( $mce_external_plugins[ $name ] );
continue;
}
$ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n";
$ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n";
$url = set_url_scheme( $url );
$mce_external_plugins[ $name ] = $url;
$plugurl = dirname( $url );
if ( in_array( $name, $loaded_langs ) ) {
$ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n";
}
}
}
$plugins = array_unique( apply_filters('tiny_mce_plugins', $plugins) );
}
if ( $set['dfw'] )
@ -286,82 +283,61 @@ final class _WP_Editors {
self::$plugins = $plugins;
self::$ext_plugins = $ext_plugins;
if ( in_array( 'spellchecker', $plugins ) ) {
/*
translators: These languages show up in the spellchecker drop-down menu, in the order specified, and with the first
language listed being the default language. They must be comma-separated and take the format of name=code, where name
is the language name (which you may internationalize), and code is a valid ISO 639 language code. Please test the
spellchecker with your values.
*/
$mce_spellchecker_languages = __( 'English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv' );
/*
The following filter allows localization scripts to change the languages displayed in the spellchecker's drop-down menu.
By default it uses Google's spellchecker API, but can be configured to use PSpell/ASpell if installed on the server.
The + sign marks the default language. More: http://www.tinymce.com/wiki.php/Plugin:spellchecker.
*/
$mce_spellchecker_languages = apply_filters( 'mce_spellchecker_languages', '+' . $mce_spellchecker_languages );
}
self::$first_init = array(
'mode' => 'exact',
'width' => '100%',
'theme' => 'advanced',
'skin' => 'wp_theme',
'theme' => 'modern',
'skin' => 'lightgray',
'language' => self::$mce_locale,
'theme_advanced_toolbar_location' => 'top',
'theme_advanced_toolbar_align' => 'left',
'theme_advanced_statusbar_location' => 'bottom',
'theme_advanced_resizing' => true,
'theme_advanced_resize_horizontal' => false,
'dialog_type' => 'modal',
'resize' => 'vertical',
'formats' => "{
alignleft : [
{selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'left'}},
{selector : 'img,table', classes : 'alignleft'}
alignleft: [
{selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: {textAlign:'left'}},
{selector: 'img,table,dl.wp-caption', classes: 'alignleft'}
],
aligncenter : [
{selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'center'}},
{selector : 'img,table', classes : 'aligncenter'}
aligncenter: [
{selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: {textAlign:'center'}},
{selector: 'img,table,dl.wp-caption', classes: 'aligncenter'}
],
alignright : [
{selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'right'}},
{selector : 'img,table', classes : 'alignright'}
alignright: [
{selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: {textAlign:'right'}},
{selector: 'img,table,dl.wp-caption', classes: 'alignright'}
],
strikethrough : {inline : 'del'}
strikethrough: {inline: 'del'}
}",
'relative_urls' => false,
'remove_script_host' => false,
'convert_urls' => false,
'remove_linebreaks' => true,
'gecko_spellcheck' => true,
'browser_spellcheck' => true,
'fix_list_elements' => true,
'keep_styles' => false,
'entities' => '38,amp,60,lt,62,gt',
'accessibility_focus' => true,
'media_strict' => false,
'entity_encoding' => 'raw',
'menubar' => false,
'object_resizing' => false,
'keep_styles' => false,
'paste_remove_styles' => true,
'paste_remove_spans' => true,
'paste_strip_class_attributes' => 'all',
'paste_text_use_dialog' => true,
'webkit_fake_resize' => false,
'preview_styles' => 'font-family font-weight text-decoration text-transform',
'schema' => 'html5',
// limit the preview styles in the menu/toolbar
// 'preview_styles' => 'font-family font-weight font-style text-decoration text-transform color background-color border',
'wpeditimage_disable_captions' => $no_captions,
'wp_fullscreen_content_css' => self::$baseurl . '/plugins/wpfullscreen/css/wp-fullscreen.css',
'plugins' => implode( ',', $plugins )
'plugins' => implode( ',', $plugins ),
);
if ( in_array( 'spellchecker', $plugins ) ) {
self::$first_init['spellchecker_rpc_url'] = self::$baseurl . '/plugins/spellchecker/rpc.php';
self::$first_init['spellchecker_languages'] = $mce_spellchecker_languages;
if ( ! empty( $mce_external_plugins ) ) {
self::$first_init['external_plugins'] = json_encode( $mce_external_plugins );
}
if ( in_array( 'spellchecker', $plugins, true ) ) {
self::$first_init['spellchecker_rpc_url'] = self::$baseurl . '/plugins/spellchecker/rpc.php';
self::$first_init['spellchecker_language'] = self::$mce_locale;
}
// WordPress default stylesheet
$mce_css = array( self::$baseurl . '/skins/wordpress/wp-content.css' );
// load editor_style.css if the current theme supports it
if ( ! empty( $GLOBALS['editor_styles'] ) && is_array( $GLOBALS['editor_styles'] ) ) {
$editor_styles = $GLOBALS['editor_styles'];
$mce_css = array();
$editor_styles = array_unique( array_filter( $editor_styles ) );
$style_uri = get_stylesheet_directory_uri();
$style_dir = get_stylesheet_directory();
@ -389,24 +365,20 @@ final class _WP_Editors {
if ( $file && file_exists( "$style_dir/$file" ) )
$mce_css[] = "$style_uri/$file";
}
$mce_css = implode( ',', $mce_css );
} else {
$mce_css = '';
}
$mce_css = trim( apply_filters( 'mce_css', $mce_css ), ' ,' );
$mce_css = trim( apply_filters( 'mce_css', implode( ',', $mce_css ) ), ' ,' );
if ( ! empty($mce_css) )
self::$first_init['content_css'] = $mce_css;
}
if ( $set['teeny'] ) {
$mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'undo', 'redo', 'link', 'unlink', 'fullscreen'), $editor_id );
$mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'undo', 'redo', 'link', 'unlink', 'fullscreen'), $editor_id );
$mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array();
} else {
$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'justifyleft', 'justifycenter', 'justifyright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' ), $editor_id);
$mce_buttons_2 = apply_filters('mce_buttons_2', array( 'formatselect', 'underline', 'justifyfull', 'forecolor', 'pastetext', 'pasteword', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' ), $editor_id);
$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'alignleft', 'aligncenter', 'alignright', 'image', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' ), $editor_id);
$mce_buttons_2 = apply_filters('mce_buttons_2', array( 'formatselect', 'underline', 'alignjustify', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' ), $editor_id);
$mce_buttons_3 = apply_filters('mce_buttons_3', array(), $editor_id);
$mce_buttons_4 = apply_filters('mce_buttons_4', array(), $editor_id);
}
@ -442,40 +414,36 @@ final class _WP_Editors {
}
$mceInit = array (
'elements' => $editor_id,
'selector' => "#$editor_id",
'wpautop' => (bool) $set['wpautop'],
'remove_linebreaks' => (bool) $set['wpautop'],
'apply_source_formatting' => (bool) !$set['wpautop'],
'theme_advanced_buttons1' => implode($mce_buttons, ','),
'theme_advanced_buttons2' => implode($mce_buttons_2, ','),
'theme_advanced_buttons3' => implode($mce_buttons_3, ','),
'theme_advanced_buttons4' => implode($mce_buttons_4, ','),
'indent' => ! $set['wpautop'],
'toolbar1' => implode($mce_buttons, ','),
'toolbar2' => implode($mce_buttons_2, ','),
'toolbar3' => implode($mce_buttons_3, ','),
'toolbar4' => implode($mce_buttons_4, ','),
'tabfocus_elements' => $set['tabfocus_elements'],
'body_class' => $body_class
);
// The main editor doesn't use the TinyMCE resizing cookie.
$mceInit['theme_advanced_resizing_use_cookie'] = 'content' !== $editor_id || empty( $set['editor_height'] );
if ( $first_run )
$mceInit = array_merge(self::$first_init, $mceInit);
$mceInit = array_merge( self::$first_init, $mceInit );
if ( is_array($set['tinymce']) )
$mceInit = array_merge($mceInit, $set['tinymce']);
if ( is_array( $set['tinymce'] ) )
$mceInit = array_merge( $mceInit, $set['tinymce'] );
// For people who really REALLY know what they're doing with TinyMCE
// You can modify $mceInit to add, remove, change elements of the config before tinyMCE.init
// Setting "valid_elements", "invalid_elements" and "extended_valid_elements" can be done through this filter.
// Best is to use the default cleanup by not specifying valid_elements, as TinyMCE contains full set of XHTML 1.0.
if ( $set['teeny'] ) {
$mceInit = apply_filters('teeny_mce_before_init', $mceInit, $editor_id);
$mceInit = apply_filters( 'teeny_mce_before_init', $mceInit, $editor_id );
} else {
$mceInit = apply_filters('tiny_mce_before_init', $mceInit, $editor_id);
$mceInit = apply_filters( 'tiny_mce_before_init', $mceInit, $editor_id );
}
if ( empty($mceInit['theme_advanced_buttons3']) && !empty($mceInit['theme_advanced_buttons4']) ) {
$mceInit['theme_advanced_buttons3'] = $mceInit['theme_advanced_buttons4'];
$mceInit['theme_advanced_buttons4'] = '';
if ( empty( $mceInit['toolbar3'] ) && ! empty( $mceInit['toolbar4'] ) ) {
$mceInit['toolbar3'] = $mceInit['toolbar4'];
$mceInit['toolbar4'] = '';
}
self::$mce_settings[$editor_id] = $mceInit;
@ -511,7 +479,7 @@ final class _WP_Editors {
if ( in_array('wplink', self::$plugins, true) || in_array('link', self::$qt_buttons, true) ) {
wp_enqueue_script('wplink');
wp_enqueue_script('wpdialogs-popup');
wp_enqueue_script('wpdialogs');
wp_enqueue_style('wp-jquery-ui-dialog');
}
@ -519,11 +487,210 @@ final class _WP_Editors {
wp_enqueue_script('wp-fullscreen');
if ( self::$has_medialib ) {
add_thickbox();
// add_thickbox(); // ?
wp_enqueue_script('media-upload');
}
}
public static function wp_mce_translation() {
$mce_translation = array(
// Default TinyMCE strings
'Cut' => __('Cut'),
'Header 2' => __('Header 2'),
'Your browser doesn\'t support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.' => __('Your browser does not support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.'),
'Div' => __('Div'),
'Paste' => __('Paste'),
'Close' => __('Close'),
'Pre' => __('Pre'),
'Align right' => __('Align right'),
'New document' => __('New document'),
'Blockquote' => __('Blockquote'),
'Numbered list' => __('Numbered list'),
'Increase indent' => __('Increase indent'),
'Formats' => __('Formats'),
'Headers' => __('Headers'),
'Select all' => __('Select all'),
'Header 3' => __('Header 3'),
'Blocks' => __('Blocks'),
'Undo' => __('Undo'),
'Strikethrough' => __('Strikethrough'),
'Bullet list' => __('Bullet list'),
'Header 1' => __('Header 1'),
'Superscript' => __('Superscript'),
'Clear formatting' => __('Clear formatting'),
'Subscript' => __('Subscript'),
'Header 6' => __('Header 6'),
'Redo' => __('Redo'),
'Paragraph' => __('Paragraph'),
'Ok' => __('Ok'),
'Bold' => __('Bold'),
'Code' => __('Code'),
'Italic' => __('Italic'),
'Align center' => __('Align center'),
'Header 5' => __('Header 5'),
'Decrease indent' => __('Decrease indent'),
'Header 4' => __('Header 4'),
'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.' => __('Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.'),
'Underline' => __('Underline'),
'Cancel' => __('Cancel'),
'Justify' => __('Justify'),
'Inline' => __('Inline'),
'Copy' => __('Copy'),
'Align left' => __('Align left'),
'Visual aids' => __('Visual aids'),
'Lower Greek' => __('Lower Greek'),
'Square' => __('Square'),
'Default' => __('Default'),
'Lower Alpha' => __('Lower Alpha'),
'Circle' => __('Circle'),
'Disc' => __('Disc'),
'Upper Alpha' => __('Upper Alpha'),
'Upper Roman' => __('Upper Roman'),
'Lower Roman' => __('Lower Roman'),
'Name' => __('Name'),
'Anchor' => __('Anchor'),
'You have unsaved changes are you sure you want to navigate away?' => __('You have unsaved changes are you sure you want to navigate away?'),
'Restore last draft' => __('Restore last draft'),
'Special character' => __('Special character'),
'Source code' => __('Source code'),
'Right to left' => __('Right to left'),
'Left to right' => __('Left to right'),
'Emoticons' => __('Emoticons'),
'Robots' => __('Robots'),
'Document properties' => __('Document properties'),
'Title' => __('Title'),
'Keywords' => __('Keywords'),
'Encoding' => __('Encoding'),
'Description' => __('Description'),
'Author' => __('Author'),
'Fullscreen' => __('Fullscreen'),
'Horizontal line' => __('Horizontal line'),
'Horizontal space' => __('Horizontal space'),
'Insert/edit image' => __('Insert/edit image'),
'General' => __('General'),
'Advanced' => __('Advanced'),
'Source' => __('Source'),
'Border' => __('Border'),
'Constrain proportions' => __('Constrain proportions'),
'Vertical space' => __('Vertical space'),
'Image description' => __('Image description'),
'Style' => __('Style'),
'Dimensions' => __('Dimensions'),
'Insert image' => __('Insert image'),
'Insert date/time' => __('Insert date/time'),
'Remove link' => __('Remove link'),
'Url' => __('Url'),
'Text to display' => __('Text to display'),
'Anchors' => __('Anchors'),
'Insert link' => __('Insert link'),
'New window' => __('New window'),
'None' => __('None'),
'Target' => __('Target'),
'Insert/edit link' => __('Insert/edit link'),
'Insert/edit video' => __('Insert/edit video'),
'Poster' => __('Poster'),
'Alternative source' => __('Alternative source'),
'Paste your embed code below:' => __('Paste your embed code below:'),
'Insert video' => __('Insert video'),
'Embed' => __('Embed'),
'Nonbreaking space' => __('Nonbreaking space'),
'Page break' => __('Page break'),
'Paste as text' => __('Paste as text'),
'Preview' => __('Preview'),
'Print' => __('Print'),
'Save' => __('Save'),
'Could not find the specified string.' => __('Could not find the specified string.'),
'Replace' => __('Replace'),
'Next' => __('Next'),
'Whole words' => __('Whole words'),
'Find and replace' => __('Find and replace'),
'Replace with' => __('Replace with'),
'Find' => __('Find'),
'Replace all' => __('Replace all'),
'Match case' => __('Match case'),
'Prev' => __('Prev'),
'Spellcheck' => __('Spellcheck'),
'Finish' => __('Finish'),
'Ignore all' => __('Ignore all'),
'Ignore' => __('Ignore'),
'Insert row before' => __('Insert row before'),
'Rows' => __('Rows'),
'Height' => __('Height'),
'Paste row after' => __('Paste row after'),
'Alignment' => __('Alignment'),
'Column group' => __('Column group'),
'Row' => __('Row'),
'Insert column before' => __('Insert column before'),
'Split cell' => __('Split cell'),
'Cell padding' => __('Cell padding'),
'Cell spacing' => __('Cell spacing'),
'Row type' => __('Row type'),
'Insert table' => __('Insert table'),
'Body' => __('Body'),
'Caption' => __('Caption'),
'Footer' => __('Footer'),
'Delete row' => __('Delete row'),
'Paste row before' => __('Paste row before'),
'Scope' => __('Scope'),
'Delete table' => __('Delete table'),
'Header cell' => __('Header cell'),
'Column' => __('Column'),
'Cell' => __('Cell'),
'Header' => __('Header'),
'Cell type' => __('Cell type'),
'Copy row' => __('Copy row'),
'Row properties' => __('Row properties'),
'Table properties' => __('Table properties'),
'Row group' => __('Row group'),
'Right' => __('Right'),
'Insert column after' => __('Insert column after'),
'Cols' => __('Cols'),
'Insert row after' => __('Insert row after'),
'Width' => __('Width'),
'Cell properties' => __('Cell properties'),
'Left' => __('Left'),
'Cut row' => __('Cut row'),
'Delete column' => __('Delete column'),
'Center' => __('Center'),
'Merge cells' => __('Merge cells'),
'Insert template' => __('Insert template'),
'Templates' => __('Templates'),
'Background color' => __('Background color'),
'Text color' => __('Text color'),
'Show blocks' => __('Show blocks'),
'Show invisible characters' => __('Show invisible characters'),
'Words: {0}' => __('Words: {0}'),
'Insert' => __('Insert'),
'File' => __('File'),
'Edit' => __('Edit'),
'Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help' => __('Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help'),
'Tools' => __('Tools'),
'View' => __('View'),
'Table' => __('Table'),
'Format' => __('Format'),
// WordPress strings
'Help' => __('Help'),
'Toolbar Toggle' => __('Toolbar Toggle'),
'Insert Read More tag' => __('Insert Read More tag'),
'Distraction Free Writing' => __('Distraction Free Writing'),
);
$baseurl = self::$baseurl;
$mce_locale = self::$mce_locale;
$mce_translation = apply_filters( 'wp_mce_translation', $mce_translation, $mce_locale );
foreach ( $mce_translation as $key => $value ) {
if ( strpos( $value, '&' ) !== false )
$mce_translation[$key] = html_entity_decode( $value, ENT_QUOTES );
}
return "tinymce.addI18n( '$mce_locale', " . json_encode( $mce_translation ) . ");\n" .
"tinymce.ScriptLoader.markDone( '$baseurl/langs/$mce_locale.js' );\n";
}
public static function editor_js() {
global $tinymce_version, $concatenate_scripts, $compress_scripts;
@ -543,9 +710,6 @@ final class _WP_Editors {
$compressed = $compress_scripts && $concatenate_scripts && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
&& false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip');
if ( $tmce_on && 'en' != self::$mce_locale )
include_once(ABSPATH . WPINC . '/js/tinymce/langs/wp-langs.php');
$mceInit = $qtInit = '';
if ( $tmce_on ) {
foreach ( self::$mce_settings as $editor_id => $init ) {
@ -569,27 +733,26 @@ final class _WP_Editors {
$ref = array(
'plugins' => implode( ',', self::$plugins ),
'theme' => 'advanced',
'theme' => 'modern',
'language' => self::$mce_locale
);
$suffix = ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ? '_src' : '';
$suffix = ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ? '' : '.min';
do_action('before_wp_tiny_mce', self::$mce_settings);
?>
do_action( 'before_wp_tiny_mce', self::$mce_settings );
?>
<script type="text/javascript">
<script type="text/javascript">
tinyMCEPreInit = {
base : "<?php echo self::$baseurl; ?>",
suffix : "<?php echo $suffix; ?>",
query : "<?php echo $version; ?>",
mceInit : <?php echo $mceInit; ?>,
qtInit : <?php echo $qtInit; ?>,
ref : <?php echo self::_parse_init( $ref ); ?>,
load_ext : function(url,lang){var sl=tinymce.ScriptLoader;sl.markDone(url+'/langs/'+lang+'.js');sl.markDone(url+'/langs/'+lang+'_dlg.js');}
baseURL: "<?php echo self::$baseurl; ?>",
suffix: "<?php echo $suffix; ?>",
mceInit: <?php echo $mceInit; ?>,
qtInit: <?php echo $qtInit; ?>,
ref: <?php echo self::_parse_init( $ref ); ?>,
load_ext: function(url,lang){var sl=tinymce.ScriptLoader;sl.markDone(url+'/langs/'+lang+'.js');sl.markDone(url+'/langs/'+lang+'_dlg.js');}
};
</script>
<?php
</script>
<?php
$baseurl = self::$baseurl;
@ -597,76 +760,59 @@ final class _WP_Editors {
if ( $compressed ) {
echo "<script type='text/javascript' src='{$baseurl}/wp-tinymce.php?c=1&amp;$version'></script>\n";
} else {
echo "<script type='text/javascript' src='{$baseurl}/tiny_mce.js?$version'></script>\n";
echo "<script type='text/javascript' src='{$baseurl}/wp-tinymce-schema.js?$version'></script>\n";
echo "<script type='text/javascript' src='{$baseurl}/tinymce.js?$version'></script>\n";
echo "<script type='text/javascript' src='{$baseurl}/plugins/compat3x/plugin{$suffix}.js?$version'></script>\n";
}
if ( 'en' != self::$mce_locale && isset($lang) )
echo "<script type='text/javascript'>\n$lang\n</script>\n";
else
if ( 'en' != self::$mce_locale )
echo "<script type='text/javascript'>\n" . self::wp_mce_translation() . "</script>\n";
if ( self::$ext_plugins ) {
// Load the old-format English strings to prevent unsightly labels in old style popups
echo "<script type='text/javascript' src='{$baseurl}/langs/wp-langs-en.js?$version'></script>\n";
}
}
$mce = ( self::$has_tinymce && wp_default_editor() == 'tinymce' ) || ! self::$has_quicktags;
?>
// Allow scripts to be added after tinymce.js has been loaded but before any editor instances are created.
do_action( 'wp_tiny_mce_init', self::$mce_settings );
<script type="text/javascript">
var wpActiveEditor;
(function(){
var init, ed, qt, first_init, DOM, el, i, mce = <?php echo (int) $mce; ?>;
if ( typeof(tinymce) == 'object' ) {
DOM = tinymce.DOM;
// mark wp_theme/ui.css as loaded
DOM.files[tinymce.baseURI.getURI() + '/themes/advanced/skins/wp_theme/ui.css'] = true;
DOM.events.add( DOM.select('.wp-editor-wrap'), 'mousedown', function(e){
if ( this.id )
wpActiveEditor = this.id.slice(3, -5);
});
for ( ed in tinyMCEPreInit.mceInit ) {
if ( first_init ) {
init = tinyMCEPreInit.mceInit[ed] = tinymce.extend( {}, first_init, tinyMCEPreInit.mceInit[ed] );
} else {
init = first_init = tinyMCEPreInit.mceInit[ed];
}
if ( mce )
try { tinymce.init(init); } catch(e){}
}
} else {
if ( tinyMCEPreInit.qtInit ) {
for ( i in tinyMCEPreInit.qtInit ) {
el = tinyMCEPreInit.qtInit[i].id;
if ( el )
document.getElementById('wp-'+el+'-wrap').onmousedown = function(){ wpActiveEditor = this.id.slice(3, -5); }
}
}
}
if ( typeof(QTags) == 'function' ) {
for ( qt in tinyMCEPreInit.qtInit ) {
try { quicktags( tinyMCEPreInit.qtInit[qt] ); } catch(e){}
}
}
})();
?>
<script type="text/javascript">
<?php
if ( self::$ext_plugins )
echo self::$ext_plugins . "\n";
if ( ! $compressed && $tmce_on ) {
?>
(function(){var t=tinyMCEPreInit,sl=tinymce.ScriptLoader,ln=t.ref.language,th=t.ref.theme,pl=t.ref.plugins;sl.markDone(t.base+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'_dlg.js');sl.markDone(t.base+'/themes/advanced/skins/wp_theme/ui.css');tinymce.each(pl.split(','),function(n){if(n&&n.charAt(0)!='-'){sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'.js');sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'_dlg.js');}});})();
<?php
}
if ( !is_admin() )
if ( ! is_admin() )
echo 'var ajaxurl = "' . admin_url( 'admin-ajax.php', 'relative' ) . '";';
?>
( function() {
var init, edId, qtId, firstInit,
loadMCE = typeof getUserSetting !== 'undefined' ? getUserSetting( 'editor' ) === 'tinymce' : true;
if ( typeof quicktags !== 'undefined' ) {
for ( qtId in tinyMCEPreInit.qtInit ) {
try { quicktags( tinyMCEPreInit.qtInit[qtId] ); } catch(e){};
}
}
if ( typeof tinymce !== 'undefined' ) {
for ( edId in tinyMCEPreInit.mceInit ) {
if ( firstInit ) {
init = tinyMCEPreInit.mceInit[edId] = tinymce.extend( {}, firstInit, tinyMCEPreInit.mceInit[edId] );
} else {
init = firstInit = tinyMCEPreInit.mceInit[edId];
}
if ( ( loadMCE || ! tinyMCEPreInit.qtInit.hasOwnProperty( edId ) ) && ! init.wp_skip_init ) {
try { tinymce.init( init ); } catch(e){}
}
}
}
}());
</script>
<?php
@ -676,91 +822,82 @@ final class _WP_Editors {
if ( in_array('wpfullscreen', self::$plugins, true) || in_array('fullscreen', self::$qt_buttons, true) )
self::wp_fullscreen_html();
do_action('after_wp_tiny_mce', self::$mce_settings);
do_action( 'after_wp_tiny_mce', self::$mce_settings );
}
public static function wp_fullscreen_html() {
global $content_width;
$post = get_post();
$width = isset($content_width) && 800 > $content_width ? $content_width : 800;
$width = isset( $content_width ) && 800 > $content_width ? $content_width : 800;
$width = $width + 22; // compensate for the padding and border
$dfw_width = get_user_setting( 'dfw_width', $width );
$save = isset($post->post_status) && $post->post_status == 'publish' ? __('Update') : __('Save');
?>
<div id="wp-fullscreen-body"<?php if ( is_rtl() ) echo ' class="rtl"'; ?>>
<div id="fullscreen-topbar">
<div id="wp-fullscreen-toolbar">
<div id="wp-fullscreen-close"><a href="#" onclick="fullscreen.off();return false;"><?php _e('Exit fullscreen'); ?></a></div>
$save = isset( $post->post_status ) && $post->post_status == 'publish' ? __('Update') : __('Save');
?>
<div id="wp-fullscreen-body"<?php if ( is_rtl() ) echo ' class="rtl"'; ?> data-theme-width="<?php echo (int) $width; ?>" data-dfw-width="<?php echo (int) $dfw_width; ?>">
<div id="fullscreen-topbar">
<div id="wp-fullscreen-toolbar">
<div id="wp-fullscreen-close"><a href="#" onclick="wp.editor.fullscreen.off();return false;"><?php _e('Exit fullscreen'); ?></a></div>
<div id="wp-fullscreen-central-toolbar" style="width:<?php echo $width; ?>px;">
<div id="wp-fullscreen-mode-bar"><div id="wp-fullscreen-modes">
<a href="#" onclick="fullscreen.switchmode('tinymce');return false;"><?php _e( 'Visual' ); ?></a>
<a href="#" onclick="fullscreen.switchmode('html');return false;"><?php _ex( 'Text', 'Name for the Text editor tab (formerly HTML)' ); ?></a>
<a href="#" onclick="wp.editor.fullscreen.switchmode('tinymce');return false;"><?php _e( 'Visual' ); ?></a>
<a href="#" onclick="wp.editor.fullscreen.switchmode('html');return false;"><?php _ex( 'Text', 'Name for the Text editor tab (formerly HTML)' ); ?></a>
</div></div>
<div id="wp-fullscreen-button-bar"><div id="wp-fullscreen-buttons" class="wp_themeSkin">
<?php
<div id="wp-fullscreen-button-bar"><div id="wp-fullscreen-buttons" class="mce-toolbar">
<?php
$buttons = array(
// format: title, onclick, show in both editors
'bold' => array( 'title' => __('Bold (Ctrl + B)'), 'onclick' => 'fullscreen.b();', 'both' => false ),
'italic' => array( 'title' => __('Italic (Ctrl + I)'), 'onclick' => 'fullscreen.i();', 'both' => false ),
'0' => 'separator',
'bullist' => array( 'title' => __('Unordered list (Alt + Shift + U)'), 'onclick' => 'fullscreen.ul();', 'both' => false ),
'numlist' => array( 'title' => __('Ordered list (Alt + Shift + O)'), 'onclick' => 'fullscreen.ol();', 'both' => false ),
'1' => 'separator',
'blockquote' => array( 'title' => __('Blockquote (Alt + Shift + Q)'), 'onclick' => 'fullscreen.blockquote();', 'both' => false ),
'image' => array( 'title' => __('Insert/edit image (Alt + Shift + M)'), 'onclick' => "fullscreen.medialib();", 'both' => true ),
'2' => 'separator',
'link' => array( 'title' => __('Insert/edit link (Alt + Shift + A)'), 'onclick' => 'fullscreen.link();', 'both' => true ),
'unlink' => array( 'title' => __('Unlink (Alt + Shift + S)'), 'onclick' => 'fullscreen.unlink();', 'both' => false ),
'3' => 'separator',
'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'onclick' => 'fullscreen.help();', 'both' => false )
'bold' => array( 'title' => __('Bold (Ctrl + B)'), 'both' => false ),
'italic' => array( 'title' => __('Italic (Ctrl + I)'), 'both' => false ),
'bullist' => array( 'title' => __('Unordered list (Alt + Shift + U)'), 'both' => false ),
'numlist' => array( 'title' => __('Ordered list (Alt + Shift + O)'), 'both' => false ),
'blockquote' => array( 'title' => __('Blockquote (Alt + Shift + Q)'), 'both' => false ),
'wp-media-library' => array( 'title' => __('Media library (Alt + Shift + M)'), 'both' => true ),
'image' => array( 'title' => __('Insert/edit image'), 'both' => false ),
'link' => array( 'title' => __('Insert/edit link (Alt + Shift + A)'), 'both' => true ),
'unlink' => array( 'title' => __('Unlink (Alt + Shift + S)'), 'both' => false ),
'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'both' => false ),
);
$buttons = apply_filters( 'wp_fullscreen_buttons', $buttons );
foreach ( $buttons as $button => $args ) {
if ( 'separator' == $args ) { ?>
<div><span aria-orientation="vertical" role="separator" class="mceSeparator"></span></div>
<?php continue;
} ?>
if ( 'separator' == $args ) {
continue;
}
<div<?php if ( $args['both'] ) { ?> class="wp-fullscreen-both"<?php } ?>>
<a title="<?php echo $args['title']; ?>" onclick="<?php echo $args['onclick']; ?>return false;" class="mceButton mceButtonEnabled mce_<?php echo $button; ?>" href="#" id="wp_fs_<?php echo $button; ?>" role="button" aria-pressed="false">
<span class="mceIcon mce_<?php echo $button; ?>"></span>
</a>
$onclick = ! empty( $args['onclick'] ) ? ' onclick="' . $args['onclick'] . '"' : '';
?>
<div class="mce-widget mce-btn<?php if ( $args['both'] ) { ?> wp-fullscreen-both<?php } ?>">
<button type="button" role="presentation" title="<?php echo $args['title']; ?>"<?php echo $onclick; ?> id="wp_fs_<?php echo $button; ?>">
<i class="mce-ico mce-i-<?php echo $button; ?>"></i>
</button>
</div>
<?php
} ?>
<?php
}
</div></div>
?>
<div id="wp-fullscreen-save">
<input type="button" class="button-primary right" value="<?php echo $save; ?>" onclick="fullscreen.save();" />
<span class="spinner"></span>
<span class="fs-saved"><?php if ( $post->post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?></span>
</div>
</div></div>
</div>
<div id="wp-fullscreen-save">
<input type="button" class="button-primary right" value="<?php echo $save; ?>" onclick="wp.editor.fullscreen.save();" />
<span class="spinner"></span>
<span class="wp-fullscreen-saved-message"><?php if ( $post->post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?></span>
<span class="wp-fullscreen-error-message"><?php _e('Save failed.'); ?></span>
</div>
</div>
</div>
</div>
<div id="wp-fullscreen-wrap" style="width:<?php echo $dfw_width; ?>px;">
<?php if ( post_type_supports($post->post_type, 'title') ) { ?>
<label id="wp-fullscreen-title-prompt-text" for="wp-fullscreen-title"><?php echo apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); ?></label>
<input type="text" id="wp-fullscreen-title" value="" autocomplete="off" />
<?php } ?>
<div id="wp-fullscreen-container">
<textarea id="wp_mce_fullscreen"></textarea>
</div>
<div id="wp-fullscreen-status">
<div id="wp-fullscreen-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></div>
<div id="wp-fullscreen-tagline"><?php _e('Just write.'); ?></div>
</div>
<div id="wp-fullscreen-status">
<div id="wp-fullscreen-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></div>
<div id="wp-fullscreen-tagline"><?php _e('Just write.'); ?></div>
</div>
</div>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -43,23 +43,13 @@ jQuery(document).ready( function($) {
});
window.onbeforeunload = function(){
var editor = typeof(tinymce) != 'undefined' ? tinymce.activeEditor : false, compareString;
var editor = typeof(tinymce) != 'undefined' ? tinymce.activeEditor : false;
if ( editor && ! editor.isHidden() ) {
if ( editor.isDirty() )
return autosaveL10n.saveAlert;
} else {
if ( fullscreen && fullscreen.settings.visible ) {
compareString = wp.autosave.getCompareString({
post_title: $('#wp-fullscreen-title').val() || '',
content: $('#wp_mce_fullscreen').val() || '',
excerpt: $('#excerpt').val() || ''
});
} else {
compareString = wp.autosave.getCompareString();
}
if ( compareString != autosaveLast )
if ( wp.autosave.getCompareString() != autosaveLast )
return autosaveL10n.saveAlert;
}
};
@ -115,25 +105,23 @@ jQuery(document).ready( function($) {
};
// This code is meant to allow tabbing from Title to Post content.
$('#title').on('keydown.editor-focus', function(e) {
var ed;
$('#title').on( 'keydown.editor-focus', function( event ) {
var editor;
if ( e.which != 9 )
return;
if ( event.which === 9 && ! event.ctrlKey && ! event.altKey && ! event.shiftKey ) {
if ( typeof tinymce !== 'undefined' ) {
editor = tinymce.get('content');
}
if ( !e.ctrlKey && !e.altKey && !e.shiftKey ) {
if ( typeof(tinymce) != 'undefined' )
ed = tinymce.get('content');
if ( ed && !ed.isHidden() ) {
$(this).one('keyup', function(){
$('#content_tbl td.mceToolbar > a').focus();
if ( editor && ! editor.isHidden() ) {
$(this).one( 'keyup', function() {
editor.focus();
});
} else {
$('#content').focus();
}
e.preventDefault();
event.preventDefault();
}
});
@ -345,20 +333,12 @@ wp.autosave.getPostData = function() {
data.autosave = false;
return data;
} else {
if ( 'mce_fullscreen' == ed.id )
tinymce.get('content').setContent(ed.getContent({format : 'raw'}), {format : 'raw'});
tinymce.triggerSave();
}
}
if ( typeof fullscreen != 'undefined' && fullscreen.settings.visible ) {
data.post_title = $('#wp-fullscreen-title').val() || '';
data.content = $('#wp_mce_fullscreen').val() || '';
} else {
data.post_title = $('#title').val() || '';
data.content = $('#content').val() || '';
}
data.post_title = $('#title').val() || '';
data.content = $('#content').val() || '';
/*
// We haven't been saving tags with autosave since 2.8... Start again?

File diff suppressed because one or more lines are too long

View File

@ -466,16 +466,13 @@
return false;
}
} else if ( mce ) {
if ( tinymce.activeEditor && (tinymce.activeEditor.id == 'mce_fullscreen' || tinymce.activeEditor.id == 'wp_mce_fullscreen') )
ed = tinymce.activeEditor;
else
ed = tinymce.get(wpActiveEditor);
ed = tinymce.get( wpActiveEditor );
}
if ( ed && !ed.isHidden() ) {
if ( ed && ! ed.isHidden() ) {
// restore caret position on IE
if ( tinymce.isIE && ed.windowManager.insertimagebookmark )
ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark);
// if ( tinymce.isIE && ed.windowManager.insertimagebookmark )
// ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark);
if ( h.indexOf('[caption') !== -1 ) {
if ( ed.wpSetImgCaption )
@ -664,7 +661,7 @@
options = options || {};
id = this.id( id );
/*
// Save a bookmark of the caret position in IE.
if ( typeof tinymce !== 'undefined' ) {
editor = tinymce.get( id );
@ -674,7 +671,7 @@
editor.windowManager.insertimagebookmark = editor.selection.getBookmark();
}
}
*/
workflow = this.get( id );
// Redo workflow if state has changed

File diff suppressed because one or more lines are too long

View File

@ -185,6 +185,9 @@ function edButton(id, display, tagStart, tagEnd, access) {
tb = document.createElement('div');
tb.id = toolbar_id;
tb.className = 'quicktags-toolbar';
tb.onclick = function() {
window.wpActiveEditor = id;
};
canvas.parentNode.insertBefore(tb, canvas);
t.toolbar = tb;
@ -563,8 +566,8 @@ function edButton(id, display, tagStart, tagEnd, access) {
qt.LinkButton.prototype.callback = function(e, c, ed, defaultValue) {
var URL, t = this;
if ( typeof(wpLink) !== 'undefined' ) {
wpLink.open();
if ( typeof wpLink !== 'undefined' ) {
wpLink.open( ed.id );
return;
}
@ -605,11 +608,11 @@ function edButton(id, display, tagStart, tagEnd, access) {
};
qt.FullscreenButton.prototype = new qt.Button();
qt.FullscreenButton.prototype.callback = function(e, c) {
if ( !c.id || typeof(fullscreen) === 'undefined' ) {
if ( ! c.id || typeof wp === 'undefined' || ! wp.editor || ! wp.editor.fullscreen ) {
return;
}
fullscreen.on();
wp.editor.fullscreen.on();
};
qt.TextDirectionButton = function() {

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,565 +0,0 @@
<?php
if ( ! defined( 'ABSPATH' ) )
exit;
if ( ! class_exists( '_WP_Editors' ) )
require( ABSPATH . WPINC . '/class-wp-editor.php' );
// deprecated, not used
function mce_escape($text) {
return esc_js($text);
}
function wp_mce_translation() {
$default = array(
'common' => array(
'edit_confirm' => __('Do you want to use the WYSIWYG mode for this textarea?'),
'apply' => __('Apply'),
'insert' => __('Insert'),
'update' => __('Update'),
'cancel' => __('Cancel'),
'close' => __('Close'),
'browse' => __('Browse'),
'class_name' => __('Class'),
'not_set' => __('-- Not set --'),
'clipboard_msg' => __('Copy/Cut/Paste is not available in Mozilla and Firefox.'),
'clipboard_no_support' => __('Currently not supported by your browser, use keyboard shortcuts instead.'),
'popup_blocked' => __('Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.'),
'invalid_data' => __('ERROR: Invalid values entered, these are marked in red.'),
'invalid_data_number' => __('{#field} must be a number'),
'invalid_data_min' => __('{#field} must be a number greater than {#min}'),
'invalid_data_size' => __('{#field} must be a number or percentage'),
'more_colors' => __('More colors')
),
'colors' => array(
'000000' => __('Black'),
'993300' => __('Burnt orange'),
'333300' => __('Dark olive'),
'003300' => __('Dark green'),
'003366' => __('Dark azure'),
'000080' => __('Navy Blue'),
'333399' => __('Indigo'),
'333333' => __('Very dark gray'),
'800000' => __('Maroon'),
'FF6600' => __('Orange'),
'808000' => __('Olive'),
'008000' => __('Green'),
'008080' => __('Teal'),
'0000FF' => __('Blue'),
'666699' => __('Grayish blue'),
'808080' => __('Gray'),
'FF0000' => __('Red'),
'FF9900' => __('Amber'),
'99CC00' => __('Yellow green'),
'339966' => __('Sea green'),
'33CCCC' => __('Turquoise'),
'3366FF' => __('Royal blue'),
'800080' => __('Purple'),
'999999' => __('Medium gray'),
'FF00FF' => __('Magenta'),
'FFCC00' => __('Gold'),
'FFFF00' => __('Yellow'),
'00FF00' => __('Lime'),
'00FFFF' => __('Aqua'),
'00CCFF' => __('Sky blue'),
'993366' => __('Brown'),
'C0C0C0' => __('Silver'),
'FF99CC' => __('Pink'),
'FFCC99' => __('Peach'),
'FFFF99' => __('Light yellow'),
'CCFFCC' => __('Pale green'),
'CCFFFF' => __('Pale cyan'),
'99CCFF' => __('Light sky blue'),
'CC99FF' => __('Plum'),
'FFFFFF' => __('White')
),
'contextmenu' => array(
'align' => __('Alignment'), /* translators: alignment */
'left' => __('Left'), /* translators: alignment */
'center' => __('Center'), /* translators: alignment */
'right' => __('Right'), /* translators: alignment */
'full' => __('Full') /* translators: alignment */
),
'insertdatetime' => array(
'date_fmt' => __('%Y-%m-%d'), /* translators: year, month, date */
'time_fmt' => __('%H:%M:%S'), /* translators: hours, minutes, seconds */
'insertdate_desc' => __('Insert date'),
'inserttime_desc' => __('Insert time'),
'months_long' => __('January').','.__('February').','.__('March').','.__('April').','.__('May').','.__('June').','.__('July').','.__('August').','.__('September').','.__('October').','.__('November').','.__('December'),
'months_short' => __('Jan_January_abbreviation').','.__('Feb_February_abbreviation').','.__('Mar_March_abbreviation').','.__('Apr_April_abbreviation').','.__('May_May_abbreviation').','.__('Jun_June_abbreviation').','.__('Jul_July_abbreviation').','.__('Aug_August_abbreviation').','.__('Sep_September_abbreviation').','.__('Oct_October_abbreviation').','.__('Nov_November_abbreviation').','.__('Dec_December_abbreviation'),
'day_long' => __('Sunday').','.__('Monday').','.__('Tuesday').','.__('Wednesday').','.__('Thursday').','.__('Friday').','.__('Saturday'),
'day_short' => __('Sun').','.__('Mon').','.__('Tue').','.__('Wed').','.__('Thu').','.__('Fri').','.__('Sat')
),
'print' => array(
'print_desc' => __('Print')
),
'preview' => array(
'preview_desc' => __('Preview')
),
'directionality' => array(
'ltr_desc' => __('Direction left to right'),
'rtl_desc' => __('Direction right to left')
),
'layer' => array(
'insertlayer_desc' => __('Insert new layer'),
'forward_desc' => __('Move forward'),
'backward_desc' => __('Move backward'),
'absolute_desc' => __('Toggle absolute positioning'),
'content' => __('New layer...')
),
'save' => array(
'save_desc' => __('Save'),
'cancel_desc' => __('Cancel all changes')
),
'nonbreaking' => array(
'nonbreaking_desc' => __('Insert non-breaking space character')
),
'iespell' => array(
'iespell_desc' => __('Run spell checking'),
'download' => __('ieSpell not detected. Do you want to install it now?')
),
'advhr' => array(
'advhr_desc' => __('Horizontal rule')
),
'emotions' => array(
'emotions_desc' => __('Emotions')
),
'searchreplace' => array(
'search_desc' => __('Find'),
'replace_desc' => __('Find/Replace')
),
'advimage' => array(
'image_desc' => __('Insert/edit image')
),
'advlink' => array(
'link_desc' => __('Insert/edit link')
),
'xhtmlxtras' => array(
'cite_desc' => __('Citation'),
'abbr_desc' => __('Abbreviation'),
'acronym_desc' => __('Acronym'),
'del_desc' => __('Deletion'),
'ins_desc' => __('Insertion'),
'attribs_desc' => __('Insert/Edit Attributes')
),
'style' => array(
'desc' => __('Edit CSS Style')
),
'paste' => array(
'paste_text_desc' => __('Paste as Plain Text'),
'paste_word_desc' => __('Paste from Word'),
'selectall_desc' => __('Select All'),
'plaintext_mode_sticky' => __('Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.'),
'plaintext_mode' => __('Paste is now in plain text mode. Click again to toggle back to regular paste mode.')
),
'paste_dlg' => array(
'text_title' => __('Use CTRL+V on your keyboard to paste the text into the window.'),
'text_linebreaks' => __('Keep linebreaks'),
'word_title' => __('Use CTRL+V on your keyboard to paste the text into the window.')
),
'table' => array(
'desc' => __('Inserts a new table'),
'row_before_desc' => __('Insert row before'),
'row_after_desc' => __('Insert row after'),
'delete_row_desc' => __('Delete row'),
'col_before_desc' => __('Insert column before'),
'col_after_desc' => __('Insert column after'),
'delete_col_desc' => __('Remove column'),
'split_cells_desc' => __('Split merged table cells'),
'merge_cells_desc' => __('Merge table cells'),
'row_desc' => __('Table row properties'),
'cell_desc' => __('Table cell properties'),
'props_desc' => __('Table properties'),
'paste_row_before_desc' => __('Paste table row before'),
'paste_row_after_desc' => __('Paste table row after'),
'cut_row_desc' => __('Cut table row'),
'copy_row_desc' => __('Copy table row'),
'del' => __('Delete table'),
'row' => __('Row'),
'col' => __('Column'),
'cell' => __('Cell')
),
'autosave' => array(
'unload_msg' => __('The changes you made will be lost if you navigate away from this page.')
),
'fullscreen' => array(
'desc' => __('Toggle fullscreen mode (Alt + Shift + G)')
),
'media' => array(
'desc' => __('Insert / edit embedded media'),
'edit' => __('Edit embedded media')
),
'fullpage' => array(
'desc' => __('Document properties')
),
'template' => array(
'desc' => __('Insert predefined template content')
),
'visualchars' => array(
'desc' => __('Visual control characters on/off.')
),
'spellchecker' => array(
'desc' => __('Toggle spellchecker (Alt + Shift + N)'),
'menu' => __('Spellchecker settings'),
'ignore_word' => __('Ignore word'),
'ignore_words' => __('Ignore all'),
'langs' => __('Languages'),
'wait' => __('Please wait...'),
'sug' => __('Suggestions'),
'no_sug' => __('No suggestions'),
'no_mpell' => __('No misspellings found.'),
'learn_word' => __('Learn word')
),
'pagebreak' => array(
'desc' => __('Insert Page Break')
),
'advlist' => array(
'types' => __('Types'),
'def' => __('Default'),
'lower_alpha' => __('Lower alpha'),
'lower_greek' => __('Lower greek'),
'lower_roman' => __('Lower roman'),
'upper_alpha' => __('Upper alpha'),
'upper_roman' => __('Upper roman'),
'circle' => __('Circle'),
'disc' => __('Disc'),
'square' => __('Square')
),
'aria' => array(
'rich_text_area' => __('Rich Text Area')
),
'wordcount' => array(
'words' => __('Words:')
)
);
$advanced = array(
'style_select' => __('Styles'), /* translators: TinyMCE inline styles */
'font_size' => __('Font size'),
'fontdefault' => __('Font family'),
'block' => __('Format'),
'paragraph' => __('Paragraph'),
'div' => __('Div'),
'address' => __('Address'),
'pre' => __('Preformatted'),
'h1' => __('Heading 1'),
'h2' => __('Heading 2'),
'h3' => __('Heading 3'),
'h4' => __('Heading 4'),
'h5' => __('Heading 5'),
'h6' => __('Heading 6'),
'blockquote' => __('Blockquote'),
'code' => __('Code'),
'samp' => __('Code sample'),
'dt' => __('Definition term '),
'dd' => __('Definition description'),
'bold_desc' => __('Bold (Ctrl + B)'),
'italic_desc' => __('Italic (Ctrl + I)'),
'underline_desc' => __('Underline'),
'striketrough_desc' => __('Strikethrough (Alt + Shift + D)'),
'justifyleft_desc' => __('Align Left (Alt + Shift + L)'),
'justifycenter_desc' => __('Align Center (Alt + Shift + C)'),
'justifyright_desc' => __('Align Right (Alt + Shift + R)'),
'justifyfull_desc' => __('Align Full (Alt + Shift + J)'),
'bullist_desc' => __('Unordered list (Alt + Shift + U)'),
'numlist_desc' => __('Ordered list (Alt + Shift + O)'),
'outdent_desc' => __('Outdent'),
'indent_desc' => __('Indent'),
'undo_desc' => __('Undo (Ctrl + Z)'),
'redo_desc' => __('Redo (Ctrl + Y)'),
'link_desc' => __('Insert/edit link (Alt + Shift + A)'),
'unlink_desc' => __('Unlink (Alt + Shift + S)'),
'image_desc' => __('Insert/edit image (Alt + Shift + M)'),
'cleanup_desc' => __('Cleanup messy code'),
'code_desc' => __('Edit HTML Source'),
'sub_desc' => __('Subscript'),
'sup_desc' => __('Superscript'),
'hr_desc' => __('Insert horizontal ruler'),
'removeformat_desc' => __('Remove formatting'),
'forecolor_desc' => __('Select text color'),
'backcolor_desc' => __('Select background color'),
'charmap_desc' => __('Insert custom character'),
'visualaid_desc' => __('Toggle guidelines/invisible elements'),
'anchor_desc' => __('Insert/edit anchor'),
'cut_desc' => __('Cut'),
'copy_desc' => __('Copy'),
'paste_desc' => __('Paste'),
'image_props_desc' => __('Image properties'),
'newdocument_desc' => __('New document'),
'help_desc' => __('Help'),
'blockquote_desc' => __('Blockquote (Alt + Shift + Q)'),
'clipboard_msg' => __('Copy/Cut/Paste is not available in Mozilla and Firefox.'),
'path' => __('Path'),
'newdocument' => __('Are you sure you want to clear all contents?'),
'toolbar_focus' => __('Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X'),
'more_colors' => __('More colors'),
'shortcuts_desc' => __('Accessibility Help'),
'help_shortcut' => __('Press ALT F10 for toolbar. Press ALT 0 for help.'),
'rich_text_area' => __('Rich Text Area'),
'toolbar' => __('Toolbar')
);
$advanced_dlg = array(
'about_title' => __('About TinyMCE'),
'about_general' => __('About'),
'about_help' => __('Help'),
'about_license' => __('License'),
'about_plugins' => __('Plugins'),
'about_plugin' => __('Plugin'),
'about_author' => __('Author'),
'about_version' => __('Version'),
'about_loaded' => __('Loaded plugins'),
'anchor_title' => __('Insert/edit anchor'),
'anchor_name' => __('Anchor name'),
'code_title' => __('HTML Source Editor'),
'code_wordwrap' => __('Word wrap'),
'colorpicker_title' => __('Select a color'),
'colorpicker_picker_tab' => __('Picker'),
'colorpicker_picker_title' => __('Color picker'),
'colorpicker_palette_tab' => __('Palette'),
'colorpicker_palette_title' => __('Palette colors'),
'colorpicker_named_tab' => __('Named'),
'colorpicker_named_title' => __('Named colors'),
'colorpicker_color' => __('Color:'),
'colorpicker_name' => _x('Name:', 'html attribute'),
'charmap_title' => __('Select custom character'),
'charmap_usage' => __('Use left and right arrows to navigate.'),
'image_title' => __('Insert/edit image'),
'image_src' => __('Image URL'),
'image_alt' => __('Image description'),
'image_list' => __('Image list'),
'image_border' => __('Border'),
'image_dimensions' => __('Dimensions'),
'image_vspace' => __('Vertical space'),
'image_hspace' => __('Horizontal space'),
'image_align' => __('Alignment'),
'image_align_baseline' => __('Baseline'),
'image_align_top' => __('Top'),
'image_align_middle' => __('Middle'),
'image_align_bottom' => __('Bottom'),
'image_align_texttop' => __('Text top'),
'image_align_textbottom' => __('Text bottom'),
'image_align_left' => __('Left'),
'image_align_right' => __('Right'),
'link_title' => __('Insert/edit link'),
'link_url' => __('Link URL'),
'link_target' => __('Target'),
'link_target_same' => __('Open link in the same window'),
'link_target_blank' => __('Open link in a new window'),
'link_titlefield' => __('Title'),
'link_is_email' => __('The URL you entered seems to be an email address, do you want to add the required mailto: prefix?'),
'link_is_external' => __('The URL you entered seems to external link, do you want to add the required http:// prefix?'),
'link_list' => __('Link list'),
'accessibility_help' => __('Accessibility Help'),
'accessibility_usage_title' => __('General Usage')
);
$media_dlg = array(
'title' => __('Insert / edit embedded media'),
'general' => __('General'),
'advanced' => __('Advanced'),
'file' => __('File/URL'),
'list' => __('List'),
'size' => __('Dimensions'),
'preview' => __('Preview'),
'constrain_proportions' => __('Constrain proportions'),
'type' => __('Type'),
'id' => __('Id'),
'name' => _x('Name', 'html attribute'),
'class_name' => __('Class'),
'vspace' => __('V-Space'),
'hspace' => __('H-Space'),
'play' => __('Auto play'),
'loop' => __('Loop'),
'menu' => __('Show menu'),
'quality' => __('Quality'),
'scale' => __('Scale'),
'align' => __('Align'),
'salign' => __('SAlign'),
'wmode' => __('WMode'),
'bgcolor' => __('Background'),
'base' => __('Base'),
'flashvars' => __('Flashvars'),
'liveconnect' => __('SWLiveConnect'),
'autohref' => __('AutoHREF'),
'cache' => __('Cache'),
'hidden' => __('Hidden'),
'controller' => __('Controller'),
'kioskmode' => __('Kiosk mode'),
'playeveryframe' => __('Play every frame'),
'targetcache' => __('Target cache'),
'correction' => __('No correction'),
'enablejavascript' => __('Enable JavaScript'),
'starttime' => __('Start time'),
'endtime' => __('End time'),
'href' => __('href'),
'qtsrcchokespeed' => __('Choke speed'),
'target' => __('Target'),
'volume' => __('Volume'),
'autostart' => __('Auto start'),
'enabled' => __('Enabled'),
'fullscreen' => __('Fullscreen'),
'invokeurls' => __('Invoke URLs'),
'mute' => __('Mute'),
'stretchtofit' => __('Stretch to fit'),
'windowlessvideo' => __('Windowless video'),
'balance' => __('Balance'),
'baseurl' => __('Base URL'),
'captioningid' => __('Captioning id'),
'currentmarker' => __('Current marker'),
'currentposition' => __('Current position'),
'defaultframe' => __('Default frame'),
'playcount' => __('Play count'),
'rate' => __('Rate'),
'uimode' => __('UI Mode'),
'flash_options' => __('Flash options'),
'qt_options' => __('QuickTime options'),
'wmp_options' => __('Windows media player options'),
'rmp_options' => __('Real media player options'),
'shockwave_options' => __('Shockwave options'),
'autogotourl' => __('Auto goto URL'),
'center' => __('Center'),
'imagestatus' => __('Image status'),
'maintainaspect' => __('Maintain aspect'),
'nojava' => __('No java'),
'prefetch' => __('Prefetch'),
'shuffle' => __('Shuffle'),
'console' => __('Console'),
'numloop' => __('Num loops'),
'controls' => __('Controls'),
'scriptcallbacks' => __('Script callbacks'),
'swstretchstyle' => __('Stretch style'),
'swstretchhalign' => __('Stretch H-Align'),
'swstretchvalign' => __('Stretch V-Align'),
'sound' => __('Sound'),
'progress' => __('Progress'),
'qtsrc' => __('QT Src'),
'qt_stream_warn' => __('Streamed rtsp resources should be added to the QT Src field under the advanced tab.'),
'align_top' => __('Top'),
'align_right' => __('Right'),
'align_bottom' => __('Bottom'),
'align_left' => __('Left'),
'align_center' => __('Center'),
'align_top_left' => __('Top left'),
'align_top_right' => __('Top right'),
'align_bottom_left' => __('Bottom left'),
'align_bottom_right' => __('Bottom right'),
'flv_options' => __('Flash video options'),
'flv_scalemode' => __('Scale mode'),
'flv_buffer' => __('Buffer'),
'flv_startimage' => __('Start image'),
'flv_starttime' => __('Start time'),
'flv_defaultvolume' => __('Default volume'),
'flv_hiddengui' => __('Hidden GUI'),
'flv_autostart' => __('Auto start'),
'flv_loop' => __('Loop'),
'flv_showscalemodes' => __('Show scale modes'),
'flv_smoothvideo' => __('Smooth video'),
'flv_jscallback' => __('JS Callback'),
'html5_video_options' => __('HTML5 Video Options'),
'altsource1' => __('Alternative source 1'),
'altsource2' => __('Alternative source 2'),
'preload' => __('Preload'),
'poster' => __('Poster'),
'source' => __('Source')
);
$wordpress = array(
'wp_adv_desc' => __('Show/Hide Kitchen Sink (Alt + Shift + Z)'),
'wp_more_desc' => __('Insert More Tag (Alt + Shift + T)'),
'wp_page_desc' => __('Insert Page break (Alt + Shift + P)'),
'wp_help_desc' => __('Help (Alt + Shift + H)'),
'wp_more_alt' => __('More...'),
'wp_page_alt' => __('Next page...'),
'add_media' => __('Add Media'),
'add_image' => __('Add an Image'),
'add_video' => __('Add Video'),
'add_audio' => __('Add Audio'),
'editgallery' => __('Edit Gallery'),
'delgallery' => __('Delete Gallery'),
'wp_fullscreen_desc' => __('Distraction Free Writing mode (Alt + Shift + W)')
);
$wpeditimage = array(
'edit_img' => __('Edit Image'),
'del_img' => __('Delete Image'),
'adv_settings' => __('Advanced Settings'),
'none' => __('None'),
'size' => __('Size'),
'thumbnail' => __('Thumbnail'),
'medium' => __('Medium'),
'full_size' => __('Full Size'),
'current_link' => __('Current Link'),
'link_to_img' => __('Link to Image'),
'link_help' => __('Enter a link URL or click above for presets.'),
'adv_img_settings' => __('Advanced Image Settings'),
'source' => __('Source'),
'width' => __('Width'),
'height' => __('Height'),
'orig_size' => __('Original Size'),
'css' => __('CSS Class'),
'adv_link_settings' => __('Advanced Link Settings'),
'link_rel' => __('Link Rel'),
'height' => __('Height'),
'orig_size' => __('Original Size'),
'css' => __('CSS Class'),
's60' => __('60%'),
's70' => __('70%'),
's80' => __('80%'),
's90' => __('90%'),
's100' => __('100%'),
's110' => __('110%'),
's120' => __('120%'),
's130' => __('130%'),
'img_title' => __('Title'),
'caption' => __('Caption'),
'alt' => __('Alternative Text')
);
$locale = _WP_Editors::$mce_locale;
$translated = 'tinyMCE.addI18n({' . $locale . ':' . json_encode( $default ) . "});\n";
$translated .= 'tinyMCE.addI18n("' . $locale . '.advanced", ' . json_encode( $advanced ) . ");\n";
$translated .= 'tinyMCE.addI18n("' . $locale . '.advanced_dlg", ' . json_encode( $advanced_dlg ) . ");\n";
$translated .= 'tinyMCE.addI18n("' . $locale . '.media_dlg", ' . json_encode( $media_dlg ) . ");\n";
$translated .= 'tinyMCE.addI18n("' . $locale . '.wordpress", ' . json_encode( $wordpress ) . ");\n";
$translated .= 'tinyMCE.addI18n("' . $locale . '.wpeditimage", ' . json_encode( $wpeditimage ) . ');';
return $translated;
}
$lang = wp_mce_translation();

View File

@ -1,21 +0,0 @@
/* global tinyMCEPreInit, tinymce */
(function(){
if ( typeof tinyMCEPreInit === 'undefined' )
return;
var t = tinyMCEPreInit, baseurl = t.base, markDone = tinymce.ScriptLoader.markDone, lang = t.ref.language,
theme = t.ref.theme, plugins = t.ref.plugins, suffix = t.suffix;
markDone( baseurl+'/langs/'+lang+'.js' );
markDone( baseurl+'/themes/'+theme+'/editor_template'+suffix+'.js' );
markDone( baseurl+'/themes/'+theme+'/langs/'+lang+'.js' );
markDone( baseurl+'/themes/'+theme+'/langs/'+lang+'_dlg.js' );
tinymce.each( plugins.split(','), function(plugin){
if ( plugin && plugin.charAt(0) != '-' ) {
markDone( baseurl+'/plugins/'+plugin+'/editor_plugin'+suffix+'.js' );
markDone( baseurl+'/plugins/'+plugin+'/langs/'+lang+'.js' );
markDone( baseurl+'/plugins/'+plugin+'/langs/'+lang+'_dlg.js' );
}
});
})();

View File

@ -0,0 +1,362 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('charmap', function(editor) {
var charmap = [
['160', 'no-break space'],
['38', 'ampersand'],
['34', 'quotation mark'],
// finance
['162', 'cent sign'],
['8364', 'euro sign'],
['163', 'pound sign'],
['165', 'yen sign'],
// signs
['169', 'copyright sign'],
['174', 'registered sign'],
['8482', 'trade mark sign'],
['8240', 'per mille sign'],
['181', 'micro sign'],
['183', 'middle dot'],
['8226', 'bullet'],
['8230', 'three dot leader'],
['8242', 'minutes / feet'],
['8243', 'seconds / inches'],
['167', 'section sign'],
['182', 'paragraph sign'],
['223', 'sharp s / ess-zed'],
// quotations
['8249', 'single left-pointing angle quotation mark'],
['8250', 'single right-pointing angle quotation mark'],
['171', 'left pointing guillemet'],
['187', 'right pointing guillemet'],
['8216', 'left single quotation mark'],
['8217', 'right single quotation mark'],
['8220', 'left double quotation mark'],
['8221', 'right double quotation mark'],
['8218', 'single low-9 quotation mark'],
['8222', 'double low-9 quotation mark'],
['60', 'less-than sign'],
['62', 'greater-than sign'],
['8804', 'less-than or equal to'],
['8805', 'greater-than or equal to'],
['8211', 'en dash'],
['8212', 'em dash'],
['175', 'macron'],
['8254', 'overline'],
['164', 'currency sign'],
['166', 'broken bar'],
['168', 'diaeresis'],
['161', 'inverted exclamation mark'],
['191', 'turned question mark'],
['710', 'circumflex accent'],
['732', 'small tilde'],
['176', 'degree sign'],
['8722', 'minus sign'],
['177', 'plus-minus sign'],
['247', 'division sign'],
['8260', 'fraction slash'],
['215', 'multiplication sign'],
['185', 'superscript one'],
['178', 'superscript two'],
['179', 'superscript three'],
['188', 'fraction one quarter'],
['189', 'fraction one half'],
['190', 'fraction three quarters'],
// math / logical
['402', 'function / florin'],
['8747', 'integral'],
['8721', 'n-ary sumation'],
['8734', 'infinity'],
['8730', 'square root'],
['8764', 'similar to'],
['8773', 'approximately equal to'],
['8776', 'almost equal to'],
['8800', 'not equal to'],
['8801', 'identical to'],
['8712', 'element of'],
['8713', 'not an element of'],
['8715', 'contains as member'],
['8719', 'n-ary product'],
['8743', 'logical and'],
['8744', 'logical or'],
['172', 'not sign'],
['8745', 'intersection'],
['8746', 'union'],
['8706', 'partial differential'],
['8704', 'for all'],
['8707', 'there exists'],
['8709', 'diameter'],
['8711', 'backward difference'],
['8727', 'asterisk operator'],
['8733', 'proportional to'],
['8736', 'angle'],
// undefined
['180', 'acute accent'],
['184', 'cedilla'],
['170', 'feminine ordinal indicator'],
['186', 'masculine ordinal indicator'],
['8224', 'dagger'],
['8225', 'double dagger'],
// alphabetical special chars
['192', 'A - grave'],
['193', 'A - acute'],
['194', 'A - circumflex'],
['195', 'A - tilde'],
['196', 'A - diaeresis'],
['197', 'A - ring above'],
['198', 'ligature AE'],
['199', 'C - cedilla'],
['200', 'E - grave'],
['201', 'E - acute'],
['202', 'E - circumflex'],
['203', 'E - diaeresis'],
['204', 'I - grave'],
['205', 'I - acute'],
['206', 'I - circumflex'],
['207', 'I - diaeresis'],
['208', 'ETH'],
['209', 'N - tilde'],
['210', 'O - grave'],
['211', 'O - acute'],
['212', 'O - circumflex'],
['213', 'O - tilde'],
['214', 'O - diaeresis'],
['216', 'O - slash'],
['338', 'ligature OE'],
['352', 'S - caron'],
['217', 'U - grave'],
['218', 'U - acute'],
['219', 'U - circumflex'],
['220', 'U - diaeresis'],
['221', 'Y - acute'],
['376', 'Y - diaeresis'],
['222', 'THORN'],
['224', 'a - grave'],
['225', 'a - acute'],
['226', 'a - circumflex'],
['227', 'a - tilde'],
['228', 'a - diaeresis'],
['229', 'a - ring above'],
['230', 'ligature ae'],
['231', 'c - cedilla'],
['232', 'e - grave'],
['233', 'e - acute'],
['234', 'e - circumflex'],
['235', 'e - diaeresis'],
['236', 'i - grave'],
['237', 'i - acute'],
['238', 'i - circumflex'],
['239', 'i - diaeresis'],
['240', 'eth'],
['241', 'n - tilde'],
['242', 'o - grave'],
['243', 'o - acute'],
['244', 'o - circumflex'],
['245', 'o - tilde'],
['246', 'o - diaeresis'],
['248', 'o slash'],
['339', 'ligature oe'],
['353', 's - caron'],
['249', 'u - grave'],
['250', 'u - acute'],
['251', 'u - circumflex'],
['252', 'u - diaeresis'],
['253', 'y - acute'],
['254', 'thorn'],
['255', 'y - diaeresis'],
['913', 'Alpha'],
['914', 'Beta'],
['915', 'Gamma'],
['916', 'Delta'],
['917', 'Epsilon'],
['918', 'Zeta'],
['919', 'Eta'],
['920', 'Theta'],
['921', 'Iota'],
['922', 'Kappa'],
['923', 'Lambda'],
['924', 'Mu'],
['925', 'Nu'],
['926', 'Xi'],
['927', 'Omicron'],
['928', 'Pi'],
['929', 'Rho'],
['931', 'Sigma'],
['932', 'Tau'],
['933', 'Upsilon'],
['934', 'Phi'],
['935', 'Chi'],
['936', 'Psi'],
['937', 'Omega'],
['945', 'alpha'],
['946', 'beta'],
['947', 'gamma'],
['948', 'delta'],
['949', 'epsilon'],
['950', 'zeta'],
['951', 'eta'],
['952', 'theta'],
['953', 'iota'],
['954', 'kappa'],
['955', 'lambda'],
['956', 'mu'],
['957', 'nu'],
['958', 'xi'],
['959', 'omicron'],
['960', 'pi'],
['961', 'rho'],
['962', 'final sigma'],
['963', 'sigma'],
['964', 'tau'],
['965', 'upsilon'],
['966', 'phi'],
['967', 'chi'],
['968', 'psi'],
['969', 'omega'],
// symbols
['8501', 'alef symbol'],
['982', 'pi symbol'],
['8476', 'real part symbol'],
['978', 'upsilon - hook symbol'],
['8472', 'Weierstrass p'],
['8465', 'imaginary part'],
// arrows
['8592', 'leftwards arrow'],
['8593', 'upwards arrow'],
['8594', 'rightwards arrow'],
['8595', 'downwards arrow'],
['8596', 'left right arrow'],
['8629', 'carriage return'],
['8656', 'leftwards double arrow'],
['8657', 'upwards double arrow'],
['8658', 'rightwards double arrow'],
['8659', 'downwards double arrow'],
['8660', 'left right double arrow'],
['8756', 'therefore'],
['8834', 'subset of'],
['8835', 'superset of'],
['8836', 'not a subset of'],
['8838', 'subset of or equal to'],
['8839', 'superset of or equal to'],
['8853', 'circled plus'],
['8855', 'circled times'],
['8869', 'perpendicular'],
['8901', 'dot operator'],
['8968', 'left ceiling'],
['8969', 'right ceiling'],
['8970', 'left floor'],
['8971', 'right floor'],
['9001', 'left-pointing angle bracket'],
['9002', 'right-pointing angle bracket'],
['9674', 'lozenge'],
['9824', 'black spade suit'],
['9827', 'black club suit'],
['9829', 'black heart suit'],
['9830', 'black diamond suit'],
['8194', 'en space'],
['8195', 'em space'],
['8201', 'thin space'],
['8204', 'zero width non-joiner'],
['8205', 'zero width joiner'],
['8206', 'left-to-right mark'],
['8207', 'right-to-left mark'],
['173', 'soft hyphen']
];
function showDialog() {
var gridHtml, x, y, win;
function getParentTd(elm) {
while (elm) {
if (elm.nodeName == 'TD') {
return elm;
}
elm = elm.parentNode;
}
}
gridHtml = '<table role="presentation" cellspacing="0" class="mce-charmap"><tbody>';
var width = 25;
for (y = 0; y < 10; y++) {
gridHtml += '<tr>';
for (x = 0; x < width; x++) {
var chr = charmap[y * width + x];
var id = 'g' + (y * width + x);
gridHtml += '<td title="' + chr[1] + '"><div id="' + id + '" tabIndex="-1">' +
(chr ? String.fromCharCode(parseInt(chr[0], 10)) : '&nbsp;') + '</div></td>';
}
gridHtml += '</tr>';
}
gridHtml += '</tbody></table>';
var charMapPanel = {
type: 'container',
html: gridHtml,
onclick: function(e) {
var target = e.target;
if (target.nodeName == 'DIV') {
editor.execCommand('mceInsertContent', false, target.firstChild.nodeValue);
}
},
onmouseover: function(e) {
var td = getParentTd(e.target);
if (td) {
win.find('#preview').text(td.firstChild.firstChild.data);
}
}
};
win = editor.windowManager.open({
title: "Special character",
spacing: 10,
padding: 10,
items: [
charMapPanel,
{
type: 'label',
name: 'preview',
text: ' ',
style: 'font-size: 40px; text-align: center',
border: 1,
minWidth: 100,
minHeight: 80
}
],
buttons: [
{text: "Close", onclick: function() {
win.close();
}}
]
});
}
editor.addButton('charmap', {
icon: 'charmap',
tooltip: 'Special character',
onclick: showDialog
});
editor.addMenuItem('charmap', {
icon: 'charmap',
text: 'Special character',
onclick: showDialog,
context: 'insert'
});
});

File diff suppressed because one or more lines are too long

View File

@ -121,15 +121,15 @@ input.mceButton:focus,
}
/* Browse */
a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}
a.pickcolor, a.browse {text-decoration:none}
a.browse span {display:block; width:20px; height:18px; 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;}
a.pickcolor span {display:block; width:20px; height:16px; margin-left:2px;}
.mceOldBoxModel a.pickcolor span {width:21px; height:17px;}
a.pickcolor:hover span {background-color:#B2BBD0;}
a.pickcolor, a.browse {text-decoration:none}
div.iframecontainer {background: #fff;}
/* Charmap */
@ -146,12 +146,11 @@ td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #A
.mceActionPanel {margin-top:5px;}
/* Tabs classes */
.tabs {width:100%; height:18px; line-height:normal; background:url(img/tabs.gif) repeat-x 0 -72px;}
.tabs {width:100%; height:19px; line-height:normal; border-bottom: 1px solid #aaa;}
.tabs ul {margin:0; padding:0; list-style:none;}
.tabs li {float:left; background:url(img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;}
.tabs li.current {background:url(img/tabs.gif) no-repeat 0 -18px; margin-right:2px;}
.tabs span {float:left; display:block; background:url(img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;}
.tabs .current span {background:url(img/tabs.gif) no-repeat right -54px;}
.tabs li {float:left; border: 1px solid #aaa; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;}
.tabs li.current {border-bottom: 1px solid #fff; margin-right:2px;}
.tabs span {float:left; display:block; padding:0px 10px 0 0;}
.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}
.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;}
@ -210,4 +209,4 @@ body[dir="rtl"] input, body[dir="rtl"] select, body[dir="rtl"] textarea,
body[dir="rtl"] #charmap #codeN,
body[dir="rtl"] .tabs a {
font-family: Tahoma, sans-serif;
}
}

View File

@ -0,0 +1,235 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true, console:true */
/**
* This plugin adds missing events form the 4.x API back. Not every event is
* properly supported but most things should work.
*
* Unsupported things:
* - No editor.onEvent
* - Can't cancel execCommands with beforeExecCommand
*/
(function(tinymce) {
var reported;
function log(apiCall) {
if (!reported && window && window.console) {
reported = true;
console.log("Deprecated TinyMCE API call: " + apiCall);
}
}
function Dispatcher(target, newEventName, argsMap, defaultScope) {
target = target || this;
this.add = function(callback, scope) {
log('<target>.on' + newEventName + ".add(..)");
// Convert callback({arg1:x, arg2:x}) -> callback(arg1, arg2)
function patchedEventCallback(e) {
var callbackArgs = [];
if (typeof argsMap == "string") {
argsMap = argsMap.split(" ");
}
if (argsMap && typeof argsMap != "function") {
for (var i = 0; i < argsMap.length; i++) {
callbackArgs.push(e[argsMap[i]]);
}
}
if (typeof argsMap == "function") {
callbackArgs = argsMap(newEventName, e, target);
if (!callbackArgs) {
return;
}
}
if (!argsMap) {
callbackArgs = [e];
}
callbackArgs.unshift(defaultScope || target);
if (callback.apply(scope || defaultScope || target, callbackArgs) === false) {
e.stopImmediatePropagation();
}
}
target.on(newEventName, patchedEventCallback);
return patchedEventCallback;
};
// Not supported to just use add
this.addToTop = this.add;
this.remove = function(callback) {
return target.off(newEventName, callback);
};
this.dispatch = function() {
target.fire(newEventName);
return true;
};
}
tinymce.onBeforeUnload = new Dispatcher(tinymce, "BeforeUnload");
tinymce.onAddEditor = new Dispatcher(tinymce, "AddEditor", "editor");
tinymce.onRemoveEditor = new Dispatcher(tinymce, "RemoveEditor", "editor");
function patchEditor(editor) {
function patchEditorEvents(oldEventNames, argsMap) {
tinymce.each(oldEventNames.split(" "), function(oldName) {
editor["on" + oldName] = new Dispatcher(editor, oldName, argsMap);
});
}
function convertUndoEventArgs(type, event, target) {
return [
event.level,
target
];
}
function filterSelectionEvents(needsSelection) {
return function(type, e) {
if ((!e.selection && !needsSelection) || e.selection == needsSelection) {
return [e];
}
};
}
if (editor.controlManager) {
return;
}
editor.controlManager = {
buttons: {},
setDisabled: function(name, state) {
log("controlManager.setDisabled(..)");
if (this.buttons[name]) {
this.buttons[name].disabled(state);
}
},
setActive: function(name, state) {
log("controlManager.setActive(..)");
if (this.buttons[name]) {
this.buttons[name].active(state);
}
},
};
patchEditorEvents("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate", "editor");
patchEditorEvents("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset");
patchEditorEvents("BeforeExecCommand ExecCommand", "command ui value args"); // args.terminate not supported
patchEditorEvents("PreProcess PostProcess LoadContent SaveContent Change");
patchEditorEvents("BeforeSetContent BeforeGetContent SetContent GetContent", filterSelectionEvents(false));
patchEditorEvents("SetProgressState", "state time");
patchEditorEvents("VisualAid", "element hasVisual");
patchEditorEvents("Undo Redo", convertUndoEventArgs);
patchEditorEvents("NodeChange", function(type, e) {
return [
editor.controlManager,
e.element,
editor.selection.isCollapsed(),
e
];
});
var originalAddButton = editor.addButton;
editor.addButton = function(name, settings) {
var originalOnPostRender;
function patchedPostRender() {
editor.controlManager.buttons[name] = this;
if (originalOnPostRender) {
return originalOnPostRender.call(this);
}
}
for (var key in settings) {
if (key.toLowerCase() === "onpostrender") {
originalOnPostRender = settings[key];
settings.onPostRender = patchedPostRender;
}
}
if (!originalOnPostRender) {
settings.onPostRender = patchedPostRender;
}
settings.title = tinymce.i18n.translate((editor.settings.language || "en") + "." + settings.title);
return originalAddButton.call(this, name, settings);
};
editor.on('init', function() {
var undoManager = editor.undoManager, selection = editor.selection;
undoManager.onUndo = new Dispatcher(editor, "Undo", convertUndoEventArgs, null, undoManager);
undoManager.onRedo = new Dispatcher(editor, "Redo", convertUndoEventArgs, null, undoManager);
undoManager.onBeforeAdd = new Dispatcher(editor, "BeforeAddUndo", null, undoManager);
undoManager.onAdd = new Dispatcher(editor, "AddUndo", null, undoManager);
selection.onBeforeGetContent = new Dispatcher(editor, "BeforeGetContent", filterSelectionEvents(true), selection);
selection.onGetContent = new Dispatcher(editor, "GetContent", filterSelectionEvents(true), selection);
selection.onBeforeSetContent = new Dispatcher(editor, "BeforeSetContent", filterSelectionEvents(true), selection);
selection.onSetContent = new Dispatcher(editor, "SetContent", filterSelectionEvents(true), selection);
editor.windowManager.createInstance = function(className, a, b, c, d, e) {
log("windowManager.createInstance(..)");
var constr = tinymce.resolve(className);
return new constr(a, b, c, d, e);
};
});
}
tinymce.on('SetupEditor', patchEditor);
tinymce.PluginManager.add("compat3x", patchEditor);
tinymce.addI18n = function(prefix, o) {
var I18n = tinymce.util.I18n, each = tinymce.each;
if (typeof(prefix) == "string" && prefix.indexOf('.') === -1) {
I18n.add(prefix, o);
return;
}
if (!tinymce.is(prefix, 'string')) {
each(prefix, function(o, lc) {
each(o, function(o, g) {
each(o, function(o, k) {
if (g === 'common') {
I18n.data[lc + '.' + k] = o;
} else {
I18n.data[lc + '.' + g + '.' + k] = o;
}
});
});
});
} else {
each(o, function(o, k) {
I18n.data[prefix + '.' + k] = o;
});
}
};
})(tinymce);

View File

@ -0,0 +1 @@
!function(n){function e(n){!i&&window&&window.console&&(i=!0,console.log("Deprecated TinyMCE API call: "+n))}function t(n,t,o,i){n=n||this,this.add=function(r,a){function d(e){var d=[];if("string"==typeof o&&(o=o.split(" ")),o&&"function"!=typeof o)for(var s=0;s<o.length;s++)d.push(e[o[s]]);("function"!=typeof o||(d=o(t,e,n)))&&(o||(d=[e]),d.unshift(i||n),r.apply(a||i||n,d)===!1&&e.stopImmediatePropagation())}return e("<target>.on"+t+".add(..)"),n.on(t,d),d},this.addToTop=this.add,this.remove=function(e){return n.off(t,e)},this.dispatch=function(){return n.fire(t),!0}}function o(o){function i(e,i){n.each(e.split(" "),function(n){o["on"+n]=new t(o,n,i)})}function r(n,e,t){return[e.level,t]}function a(n){return function(e,t){return!t.selection&&!n||t.selection==n?[t]:void 0}}if(!o.controlManager){o.controlManager={buttons:{},setDisabled:function(n,t){e("controlManager.setDisabled(..)"),this.buttons[n]&&this.buttons[n].disabled(t)},setActive:function(n,t){e("controlManager.setActive(..)"),this.buttons[n]&&this.buttons[n].active(t)}},i("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate","editor"),i("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset"),i("BeforeExecCommand ExecCommand","command ui value args"),i("PreProcess PostProcess LoadContent SaveContent Change"),i("BeforeSetContent BeforeGetContent SetContent GetContent",a(!1)),i("SetProgressState","state time"),i("VisualAid","element hasVisual"),i("Undo Redo",r),i("NodeChange",function(n,e){return[o.controlManager,e.element,o.selection.isCollapsed(),e]});var d=o.addButton;o.addButton=function(e,t){function i(){return o.controlManager.buttons[e]=this,r?r.call(this):void 0}var r;for(var a in t)"onpostrender"===a.toLowerCase()&&(r=t[a],t.onPostRender=i);return r||(t.onPostRender=i),t.title=n.i18n.translate((o.settings.language||"en")+"."+t.title),d.call(this,e,t)},o.on("init",function(){var i=o.undoManager,d=o.selection;i.onUndo=new t(o,"Undo",r,null,i),i.onRedo=new t(o,"Redo",r,null,i),i.onBeforeAdd=new t(o,"BeforeAddUndo",null,i),i.onAdd=new t(o,"AddUndo",null,i),d.onBeforeGetContent=new t(o,"BeforeGetContent",a(!0),d),d.onGetContent=new t(o,"GetContent",a(!0),d),d.onBeforeSetContent=new t(o,"BeforeSetContent",a(!0),d),d.onSetContent=new t(o,"SetContent",a(!0),d),o.windowManager.createInstance=function(t,o,i,r,a,d){e("windowManager.createInstance(..)");var s=n.resolve(t);return new s(o,i,r,a,d)}})}}var i;n.onBeforeUnload=new t(n,"BeforeUnload"),n.onAddEditor=new t(n,"AddEditor","editor"),n.onRemoveEditor=new t(n,"RemoveEditor","editor"),n.on("SetupEditor",o),n.PluginManager.add("compat3x",o),n.addI18n=function(e,t){var o=n.util.I18n,i=n.each;return"string"==typeof e&&-1===e.indexOf(".")?(o.add(e,t),void 0):(n.is(e,"string")?i(t,function(n,t){o.data[e+"."+t]=n}):i(e,function(n,e){i(n,function(n,t){i(n,function(n,i){"common"===t?o.data[e+"."+i]=n:o.data[e+"."+t+"."+i]=n})})}),void 0)}}(tinymce);

View File

@ -1 +0,0 @@
(function(){tinymce.create("tinymce.plugins.Directionality",{init:function(b,c){var d=this;d.editor=b;function a(e){var h=b.dom,g,f=b.selection.getSelectedBlocks();if(f.length){g=h.getAttrib(f[0],"dir");tinymce.each(f,function(i){if(!h.getParent(i.parentNode,"*[dir='"+e+"']",h.getRoot())){if(g!=e){h.setAttrib(i,"dir",e)}else{h.setAttrib(i,"dir",null)}}});b.nodeChanged()}}b.addCommand("mceDirectionLTR",function(){a("ltr")});b.addCommand("mceDirectionRTL",function(){a("rtl")});b.addButton("ltr",{title:"directionality.ltr_desc",cmd:"mceDirectionLTR"});b.addButton("rtl",{title:"directionality.rtl_desc",cmd:"mceDirectionRTL"});b.onNodeChange.add(d._nodeChange,d)},getInfo:function(){return{longname:"Directionality",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,e){var d=b.dom,c;e=d.getParent(e,d.isBlock);if(!e){a.setDisabled("ltr",1);a.setDisabled("rtl",1);return}c=d.getAttrib(e,"dir");a.setActive("ltr",c=="ltr");a.setDisabled("ltr",0);a.setActive("rtl",c=="rtl");a.setDisabled("rtl",0)}});tinymce.PluginManager.add("directionality",tinymce.plugins.Directionality)})();

View File

@ -1,85 +0,0 @@
/**
* editor_plugin_src.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
tinymce.create('tinymce.plugins.Directionality', {
init : function(ed, url) {
var t = this;
t.editor = ed;
function setDir(dir) {
var dom = ed.dom, curDir, blocks = ed.selection.getSelectedBlocks();
if (blocks.length) {
curDir = dom.getAttrib(blocks[0], "dir");
tinymce.each(blocks, function(block) {
// Add dir to block if the parent block doesn't already have that dir
if (!dom.getParent(block.parentNode, "*[dir='" + dir + "']", dom.getRoot())) {
if (curDir != dir) {
dom.setAttrib(block, "dir", dir);
} else {
dom.setAttrib(block, "dir", null);
}
}
});
ed.nodeChanged();
}
}
ed.addCommand('mceDirectionLTR', function() {
setDir("ltr");
});
ed.addCommand('mceDirectionRTL', function() {
setDir("rtl");
});
ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'});
ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'});
ed.onNodeChange.add(t._nodeChange, t);
},
getInfo : function() {
return {
longname : 'Directionality',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',
version : tinymce.majorVersion + "." + tinymce.minorVersion
};
},
// Private methods
_nodeChange : function(ed, cm, n) {
var dom = ed.dom, dir;
n = dom.getParent(n, dom.isBlock);
if (!n) {
cm.setDisabled('ltr', 1);
cm.setDisabled('rtl', 1);
return;
}
dir = dom.getAttrib(n, 'dir');
cm.setActive('ltr', dir == "ltr");
cm.setDisabled('ltr', 0);
cm.setActive('rtl', dir == "rtl");
cm.setDisabled('rtl', 0);
}
});
// Register plugin
tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality);
})();

View File

@ -0,0 +1,64 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('directionality', function(editor) {
function setDir(dir) {
var dom = editor.dom, curDir, blocks = editor.selection.getSelectedBlocks();
if (blocks.length) {
curDir = dom.getAttrib(blocks[0], "dir");
tinymce.each(blocks, function(block) {
// Add dir to block if the parent block doesn't already have that dir
if (!dom.getParent(block.parentNode, "*[dir='" + dir + "']", dom.getRoot())) {
if (curDir != dir) {
dom.setAttrib(block, "dir", dir);
} else {
dom.setAttrib(block, "dir", null);
}
}
});
editor.nodeChanged();
}
}
function generateSelector(dir) {
var selector = [];
tinymce.each('h1 h2 h3 h4 h5 h6 div p'.split(' '), function(name) {
selector.push(name + '[dir=' + dir + ']');
});
return selector.join(',');
}
editor.addCommand('mceDirectionLTR', function() {
setDir("ltr");
});
editor.addCommand('mceDirectionRTL', function() {
setDir("rtl");
});
editor.addButton('ltr', {
title: 'Left to right',
cmd: 'mceDirectionLTR',
stateSelector: generateSelector('ltr')
});
editor.addButton('rtl', {
title: 'Right to left',
cmd: 'mceDirectionRTL',
stateSelector: generateSelector('rtl')
});
});

View File

@ -0,0 +1 @@
tinymce.PluginManager.add("directionality",function(e){function t(t){var n,i=e.dom,a=e.selection.getSelectedBlocks();a.length&&(n=i.getAttrib(a[0],"dir"),tinymce.each(a,function(e){i.getParent(e.parentNode,"*[dir='"+t+"']",i.getRoot())||(n!=t?i.setAttrib(e,"dir",t):i.setAttrib(e,"dir",null))}),e.nodeChanged())}function n(e){var t=[];return tinymce.each("h1 h2 h3 h4 h5 h6 div p".split(" "),function(n){t.push(n+"[dir="+e+"]")}),t.join(",")}e.addCommand("mceDirectionLTR",function(){t("ltr")}),e.addCommand("mceDirectionRTL",function(){t("rtl")}),e.addButton("ltr",{title:"Left to right",cmd:"mceDirectionLTR",stateSelector:n("ltr")}),e.addButton("rtl",{title:"Right to left",cmd:"mceDirectionRTL",stateSelector:n("rtl")})});

View File

@ -1 +0,0 @@
(function(){var b=tinymce.DOM;var a=function(d,f,e){var c=function(g){var i=d.controlManager.get(g);var h=f.controlManager.get(g);if(i&&h){h.displayColor(i.value)}};c("forecolor");c("backcolor");f.setContent(d.getContent({format:"raw"}),{format:"raw"});f.selection.moveToBookmark(e);if(d.plugins.spellchecker&&f.plugins.spellchecker){f.plugins.spellchecker.setLanguage(d.plugins.spellchecker.selectedLang)}};tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(i,c){var l=this,m={},k=b.doc.documentElement,d,o,h,g,f,e,j;i.addCommand("mceFullScreen",function(){var q,r;if(i.getParam("fullscreen_is_enabled")){if(i.getParam("fullscreen_new_window")){closeFullscreen()}else{b.win.setTimeout(function(){var t=i;var s=tinyMCE.get(t.getParam("fullscreen_editor_id"));s.plugins.fullscreen.saveState(t);tinyMCE.remove(t)},10)}return}if(i.getParam("fullscreen_new_window")){l.fullscreenSettings={bookmark:i.selection.getBookmark()};q=b.win.open(c+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{q.resizeTo(screen.availWidth,screen.availHeight)}catch(p){}}else{o=b.getStyle(b.doc.body,"overflow",1)||"auto";h=b.getStyle(k,"overflow",1);d=b.getViewPort();g=d.x;f=d.y;if(tinymce.isOpera&&o=="visible"){o="auto"}if(tinymce.isIE&&o=="scroll"){o="auto"}if(tinymce.isIE&&(h=="visible"||h=="scroll")){h="auto"}if(o=="0px"){o=""}b.setStyle(b.doc.body,"overflow","hidden");k.style.overflow="hidden";d=b.getViewPort();b.win.scrollTo(0,0);if(tinymce.isIE){d.h-=1}if(tinymce.isIE6||document.compatMode=="BackCompat"){e="absolute;top:"+d.y}else{e="fixed;top:0"}n=b.add(b.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+e+";left:0;width:"+d.w+"px;height:"+d.h+"px;z-index:200000;"});b.add(n,"div",{id:"mce_fullscreen"});tinymce.each(i.settings,function(s,t){m[t]=s});m.id="mce_fullscreen";m.width=n.clientWidth;m.height=n.clientHeight-15;m.fullscreen_is_enabled=true;m.fullscreen_editor_id=i.id;m.theme_advanced_resizing=false;m.save_onsavecallback=function(){i.setContent(tinyMCE.get(m.id).getContent());i.execCommand("mceSave")};tinymce.each(i.getParam("fullscreen_settings"),function(t,s){m[s]=t});l.fullscreenSettings={bookmark:i.selection.getBookmark(),fullscreen_overflow:o,fullscreen_html_overflow:h,fullscreen_scrollx:g,fullscreen_scrolly:f};if(m.theme_advanced_toolbar_location==="external"){m.theme_advanced_toolbar_location="top"}tinyMCE.oldSettings=tinyMCE.settings;l.fullscreenEditor=new tinymce.Editor("mce_fullscreen",m);l.fullscreenEditor.onInit.add(function(){l.loadState(l.fullscreenEditor)});l.fullscreenEditor.render();l.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");l.fullscreenElement.update();l.resizeFunc=tinymce.dom.Event.add(b.win,"resize",function(){var v=tinymce.DOM.getViewPort(),t=l.fullscreenEditor,s,u;s=t.dom.getSize(t.getContainer().getElementsByTagName("table")[0]);u=t.dom.getSize(t.getContainer().getElementsByTagName("iframe")[0]);t.theme.resizeTo(v.w-s.w+u.w,v.h-s.h+u.h)})}});i.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});i.onNodeChange.add(function(q,p){p.setActive("fullscreen",q.getParam("fullscreen_is_enabled"))});l.loadState=function(p){if(!(p&&l.fullscreenSettings)){throw"No fullscreen editor to load to"}a(i,p,l.fullscreenSettings.bookmark);p.focus()};l.saveState=function(q){if(!(q&&l.fullscreenSettings)){throw"No fullscreen editor to restore from"}var p=l.fullscreenSettings;a(q,i,q.selection.getBookmark());if(!i.getParam("fullscreen_new_window")){tinymce.dom.Event.remove(b.win,"resize",l.resizeFunc);delete l.resizeFunc;b.remove("mce_fullscreen_container");b.doc.documentElement.style.overflow=p.fullscreen_html_overflow;b.setStyle(b.doc.body,"overflow",p.fullscreen_overflow);b.win.scrollTo(p.fullscreen_scrollx,p.fullscreen_scrolly)}tinyMCE.settings=tinyMCE.oldSettings;delete tinyMCE.oldSettings;delete l.fullscreenEditor;delete l.fullscreenElement;delete l.fullscreenSettings;b.win.setTimeout(function(){i.selection.moveToBookmark(j);i.focus()},10)}},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})();

View File

@ -1,234 +0,0 @@
/**
* editor_plugin_src.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
var DOM = tinymce.DOM;
// State Transfer function
var transferState = function(oldEditor, newEditor, bookmark) {
var transferColorButtonState = function(swapme) {
var c = oldEditor.controlManager.get(swapme);
var newC = newEditor.controlManager.get(swapme);
if (c && newC) {
newC.displayColor(c.value);
}
};
transferColorButtonState('forecolor');
transferColorButtonState('backcolor');
newEditor.setContent(oldEditor.getContent({format : 'raw'}), {format : 'raw'});
newEditor.selection.moveToBookmark(bookmark);
if (oldEditor.plugins.spellchecker && newEditor.plugins.spellchecker) {
newEditor.plugins.spellchecker.setLanguage(oldEditor.plugins.spellchecker.selectedLang);
}
};
tinymce.create('tinymce.plugins.FullScreenPlugin', {
init : function(ed, url) {
var t = this, s = {}, de = DOM.doc.documentElement, vp, fullscreen_overflow, fullscreen_html_overflow, fullscreen_scrollx, fullscreen_scrolly, posCss, bookmark;
// Register commands
ed.addCommand('mceFullScreen', function() {
var win, oed;
if (ed.getParam('fullscreen_is_enabled')) {
if (ed.getParam('fullscreen_new_window'))
closeFullscreen(); // Call to close in fullscreen.htm
else {
DOM.win.setTimeout(function() {
var fullscreenEditor = ed;
// find the editor that opened this one, execute restore function there
var originalEditor = tinyMCE.get(fullscreenEditor.getParam('fullscreen_editor_id'));
originalEditor.plugins.fullscreen.saveState(fullscreenEditor);
tinyMCE.remove(fullscreenEditor);
}, 10);
}
return;
}
if (ed.getParam('fullscreen_new_window')) {
t.fullscreenSettings = {
bookmark: ed.selection.getBookmark()
};
win = DOM.win.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight);
try {
win.resizeTo(screen.availWidth, screen.availHeight);
} catch (e) {
// Ignore
}
} else {
fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto';
fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1);
vp = DOM.getViewPort();
fullscreen_scrollx = vp.x;
fullscreen_scrolly = vp.y;
// Fixes an Opera bug where the scrollbars doesn't reappear
if (tinymce.isOpera && fullscreen_overflow == 'visible')
fullscreen_overflow = 'auto';
// Fixes an IE bug where horizontal scrollbars would appear
if (tinymce.isIE && fullscreen_overflow == 'scroll')
fullscreen_overflow = 'auto';
// Fixes an IE bug where the scrollbars doesn't reappear
if (tinymce.isIE && (fullscreen_html_overflow == 'visible' || fullscreen_html_overflow == 'scroll'))
fullscreen_html_overflow = 'auto';
if (fullscreen_overflow == '0px')
fullscreen_overflow = '';
DOM.setStyle(DOM.doc.body, 'overflow', 'hidden');
de.style.overflow = 'hidden'; //Fix for IE6/7
vp = DOM.getViewPort();
DOM.win.scrollTo(0, 0);
if (tinymce.isIE)
vp.h -= 1;
// Use fixed position if it exists
if (tinymce.isIE6 || document.compatMode == 'BackCompat')
posCss = 'absolute;top:' + vp.y;
else
posCss = 'fixed;top:0';
n = DOM.add(DOM.doc.body, 'div', {
id : 'mce_fullscreen_container',
style : 'position:' + posCss + ';left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'});
DOM.add(n, 'div', {id : 'mce_fullscreen'});
tinymce.each(ed.settings, function(v, n) {
s[n] = v;
});
s.id = 'mce_fullscreen';
s.width = n.clientWidth;
s.height = n.clientHeight - 15;
s.fullscreen_is_enabled = true;
s.fullscreen_editor_id = ed.id;
s.theme_advanced_resizing = false;
s.save_onsavecallback = function() {
ed.setContent(tinyMCE.get(s.id).getContent());
ed.execCommand('mceSave');
};
tinymce.each(ed.getParam('fullscreen_settings'), function(v, k) {
s[k] = v;
});
t.fullscreenSettings = {
bookmark: ed.selection.getBookmark(),
fullscreen_overflow: fullscreen_overflow,
fullscreen_html_overflow: fullscreen_html_overflow,
fullscreen_scrollx: fullscreen_scrollx,
fullscreen_scrolly: fullscreen_scrolly
};
if (s.theme_advanced_toolbar_location === 'external')
s.theme_advanced_toolbar_location = 'top';
tinyMCE.oldSettings = tinyMCE.settings; // Store old settings, the Editor constructor overwrites them
t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s);
t.fullscreenEditor.onInit.add(function() {
t.loadState(t.fullscreenEditor);
});
t.fullscreenEditor.render();
t.fullscreenElement = new tinymce.dom.Element('mce_fullscreen_container');
t.fullscreenElement.update();
//document.body.overflow = 'hidden';
t.resizeFunc = tinymce.dom.Event.add(DOM.win, 'resize', function() {
var vp = tinymce.DOM.getViewPort(), fed = t.fullscreenEditor, outerSize, innerSize;
// Get outer/inner size to get a delta size that can be used to calc the new iframe size
outerSize = fed.dom.getSize(fed.getContainer().getElementsByTagName('table')[0]);
innerSize = fed.dom.getSize(fed.getContainer().getElementsByTagName('iframe')[0]);
fed.theme.resizeTo(vp.w - outerSize.w + innerSize.w, vp.h - outerSize.h + innerSize.h);
});
}
});
// Register buttons
ed.addButton('fullscreen', {title : 'fullscreen.desc', cmd : 'mceFullScreen'});
ed.onNodeChange.add(function(ed, cm) {
cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled'));
});
// fullscreenEditor is a param here because in window mode we don't create it
t.loadState = function(fullscreenEditor) {
if (!(fullscreenEditor && t.fullscreenSettings)) {
throw "No fullscreen editor to load to";
}
transferState(ed, fullscreenEditor, t.fullscreenSettings.bookmark);
fullscreenEditor.focus();
};
// fullscreenEditor is a param here because in window mode we don't create it
t.saveState = function(fullscreenEditor) {
if (!(fullscreenEditor && t.fullscreenSettings)) {
throw "No fullscreen editor to restore from";
}
var settings = t.fullscreenSettings;
transferState(fullscreenEditor, ed, fullscreenEditor.selection.getBookmark());
// cleanup only required if window mode isn't used
if (!ed.getParam('fullscreen_new_window')) {
tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc);
delete t.resizeFunc;
DOM.remove('mce_fullscreen_container');
DOM.doc.documentElement.style.overflow = settings.fullscreen_html_overflow;
DOM.setStyle(DOM.doc.body, 'overflow', settings.fullscreen_overflow);
DOM.win.scrollTo(settings.fullscreen_scrollx, settings.fullscreen_scrolly);
}
tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings
// clear variables
delete tinyMCE.oldSettings;
delete t.fullscreenEditor;
delete t.fullscreenElement;
delete t.fullscreenSettings;
// allow the fullscreen editor to be removed before restoring focus and selection
DOM.win.setTimeout(function() {
ed.selection.moveToBookmark(bookmark);
ed.focus();
}, 10);
};
},
getInfo : function() {
return {
longname : 'Fullscreen',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',
version : tinymce.majorVersion + "." + tinymce.minorVersion
};
}
});
// Register plugin
tinymce.PluginManager.add('fullscreen', tinymce.plugins.FullScreenPlugin);
})();

View File

@ -1,117 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script type="text/javascript" src="../../tiny_mce.js?ver=359-20131010"></script>
<script type="text/javascript">
function patchCallback(settings, key) {
if (settings[key])
settings[key] = "window.opener." + settings[key];
}
var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings, oeID = window.opener.tinyMCE.activeEditor.id;
// Clone array
for (var n in paSe)
settings[n] = paSe[n];
// Override options for fullscreen
for (var n in paSe.fullscreen_settings)
settings[n] = paSe.fullscreen_settings[n];
// Patch callbacks, make them point to window.opener
patchCallback(settings, 'urlconverter_callback');
patchCallback(settings, 'insertlink_callback');
patchCallback(settings, 'insertimage_callback');
patchCallback(settings, 'setupcontent_callback');
patchCallback(settings, 'save_callback');
patchCallback(settings, 'onchange_callback');
patchCallback(settings, 'init_instance_callback');
patchCallback(settings, 'file_browser_callback');
patchCallback(settings, 'cleanup_callback');
patchCallback(settings, 'execcommand_callback');
patchCallback(settings, 'oninit');
// Set options
delete settings.id;
settings['mode'] = 'exact';
settings['elements'] = 'fullscreenarea';
settings['add_unload_trigger'] = false;
settings['ask'] = false;
settings['document_base_url'] = window.opener.tinyMCE.activeEditor.documentBaseURI.getURI();
settings['fullscreen_is_enabled'] = true;
settings['fullscreen_editor_id'] = oeID;
settings['theme_advanced_resizing'] = false;
settings['strict_loading_mode'] = true;
settings.save_onsavecallback = function() {
moveContent();
window.opener.tinyMCE.get(oeID).execCommand('mceSave');
window.close();
};
function unloadHandler(e) {
moveContent();
}
function moveContent() {
// find the original editor, execute restore state in it's plugin instance
window.opener.tinyMCE.get(oeID).plugins.fullscreen.saveState(tinyMCE.activeEditor);
// prevent moveContent from being called twice - e.g. if the unloadHandler runs after moveContent()
tinymce.dom.Event.remove(window, "beforeunload", unloadHandler);
}
function closeFullscreen() {
// moveContent() will be called by the unload handler
window.close();
}
function doParentSubmit() {
moveContent();
if (window.opener.tinyMCE.selectedInstance.formElement.form)
window.opener.tinyMCE.selectedInstance.formElement.form.submit();
window.close();
return false;
}
function render() {
var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM;
vp = dom.getViewPort();
settings.width = vp.w;
settings.height = vp.h - 15;
settings.oninit = function() {
var ed = tinyMCE.activeEditor;
window.opener.tinyMCE.get(oeID).plugins.fullscreen.loadState(ed);
tinymce.dom.Event.add(window, 'resize', function() {
var vp = dom.getViewPort();
tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h);
});
}
tinyMCE.init(settings);
}
// Add onunload
tinymce.dom.Event.add(window, "beforeunload", unloadHandler);
</script>
</head>
<body style="margin:0;overflow:hidden;width:100%;height:100%" scrolling="no" scroll="no">
<form onsubmit="doParentSubmit();">
<textarea id="fullscreenarea" style="width:100%; height:100%"></textarea>
</form>
<script type="text/javascript">
render();
</script>
</body>
</html>

View File

@ -0,0 +1,136 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('fullscreen', function(editor) {
var fullscreenState = false, DOM = tinymce.DOM, iframeWidth, iframeHeight, resizeHandler;
var containerWidth, containerHeight;
if (editor.settings.inline) {
return;
}
function getWindowSize() {
var w, h, win = window, doc = document;
var body = doc.body;
// Old IE
if (body.offsetWidth) {
w = body.offsetWidth;
h = body.offsetHeight;
}
// Modern browsers
if (win.innerWidth && win.innerHeight) {
w = win.innerWidth;
h = win.innerHeight;
}
return {w: w, h: h};
}
function toggleFullscreen() {
var body = document.body, documentElement = document.documentElement, editorContainerStyle;
var editorContainer, iframe, iframeStyle;
function resize() {
DOM.setStyle(iframe, 'height', getWindowSize().h - (editorContainer.clientHeight - iframe.clientHeight));
}
fullscreenState = !fullscreenState;
editorContainer = editor.getContainer();
editorContainerStyle = editorContainer.style;
iframe = editor.getContentAreaContainer().firstChild;
iframeStyle = iframe.style;
if (fullscreenState) {
iframeWidth = iframeStyle.width;
iframeHeight = iframeStyle.height;
iframeStyle.width = iframeStyle.height = '100%';
containerWidth = editorContainerStyle.width;
containerHeight = editorContainerStyle.height;
editorContainerStyle.width = editorContainerStyle.height = '';
DOM.addClass(body, 'mce-fullscreen');
DOM.addClass(documentElement, 'mce-fullscreen');
DOM.addClass(editorContainer, 'mce-fullscreen');
DOM.bind(window, 'resize', resize);
resize();
resizeHandler = resize;
} else {
iframeStyle.width = iframeWidth;
iframeStyle.height = iframeHeight;
if (containerWidth) {
editorContainerStyle.width = containerWidth;
}
if (containerHeight) {
editorContainerStyle.height = containerHeight;
}
DOM.removeClass(body, 'mce-fullscreen');
DOM.removeClass(documentElement, 'mce-fullscreen');
DOM.removeClass(editorContainer, 'mce-fullscreen');
DOM.unbind(window, 'resize', resizeHandler);
}
editor.fire('FullscreenStateChanged', {state: fullscreenState});
}
editor.on('init', function() {
editor.addShortcut('Ctrl+Alt+F', '', toggleFullscreen);
});
editor.on('remove', function() {
if (resizeHandler) {
DOM.unbind(window, 'resize', resizeHandler);
}
});
editor.addCommand('mceFullScreen', toggleFullscreen);
editor.addMenuItem('fullscreen', {
text: 'Fullscreen',
shortcut: 'Ctrl+Alt+F',
selectable: true,
onClick: toggleFullscreen,
onPostRender: function() {
var self = this;
editor.on('FullscreenStateChanged', function(e) {
self.active(e.state);
});
},
context: 'view'
});
editor.addButton('fullscreen', {
tooltip: 'Fullscreen',
shortcut: 'Ctrl+Alt+F',
onClick: toggleFullscreen,
onPostRender: function() {
var self = this;
editor.on('FullscreenStateChanged', function(e) {
self.active(e.state);
});
}
});
return {
isFullscreen: function() {
return fullscreenState;
}
};
});

View File

@ -0,0 +1 @@
tinymce.PluginManager.add("fullscreen",function(e){function t(){var e,t,n=window,i=document,l=i.body;return l.offsetWidth&&(e=l.offsetWidth,t=l.offsetHeight),n.innerWidth&&n.innerHeight&&(e=n.innerWidth,t=n.innerHeight),{w:e,h:t}}function n(){function n(){d.setStyle(a,"height",t().h-(h.clientHeight-a.clientHeight))}var u,h,a,f,m=document.body,g=document.documentElement;s=!s,h=e.getContainer(),u=h.style,a=e.getContentAreaContainer().firstChild,f=a.style,s?(i=f.width,l=f.height,f.width=f.height="100%",c=u.width,o=u.height,u.width=u.height="",d.addClass(m,"mce-fullscreen"),d.addClass(g,"mce-fullscreen"),d.addClass(h,"mce-fullscreen"),d.bind(window,"resize",n),n(),r=n):(f.width=i,f.height=l,c&&(u.width=c),o&&(u.height=o),d.removeClass(m,"mce-fullscreen"),d.removeClass(g,"mce-fullscreen"),d.removeClass(h,"mce-fullscreen"),d.unbind(window,"resize",r)),e.fire("FullscreenStateChanged",{state:s})}var i,l,r,c,o,s=!1,d=tinymce.DOM;return e.settings.inline?void 0:(e.on("init",function(){e.addShortcut("Ctrl+Alt+F","",n)}),e.on("remove",function(){r&&d.unbind(window,"resize",r)}),e.addCommand("mceFullScreen",n),e.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Ctrl+Alt+F",selectable:!0,onClick:n,onPostRender:function(){var t=this;e.on("FullscreenStateChanged",function(e){t.active(e.state)})},context:"view"}),e.addButton("fullscreen",{tooltip:"Fullscreen",shortcut:"Ctrl+Alt+F",onClick:n,onPostRender:function(){var t=this;e.on("FullscreenStateChanged",function(e){t.active(e.state)})}}),{isFullscreen:function(){return s}})});

View File

@ -0,0 +1,370 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('image', function(editor) {
function getImageSize(url, callback) {
var img = document.createElement('img');
function done(width, height) {
img.parentNode.removeChild(img);
callback({width: width, height: height});
}
img.onload = function() {
done(img.clientWidth, img.clientHeight);
};
img.onerror = function() {
done();
};
img.src = url;
var style = img.style;
style.visibility = 'hidden';
style.position = 'fixed';
style.bottom = style.left = 0;
style.width = style.height = 'auto';
document.body.appendChild(img);
}
function createImageList(callback) {
return function() {
var imageList = editor.settings.image_list;
if (typeof(imageList) == "string") {
tinymce.util.XHR.send({
url: imageList,
success: function(text) {
callback(tinymce.util.JSON.parse(text));
}
});
} else {
callback(imageList);
}
};
}
function showDialog(imageList) {
var win, data = {}, dom = editor.dom, imgElm = editor.selection.getNode();
var width, height, imageListCtrl;
function buildImageList() {
var imageListItems = [{text: 'None', value: ''}];
tinymce.each(imageList, function(image) {
imageListItems.push({
text: image.text || image.title,
value: editor.convertURL(image.value || image.url, 'src'),
menu: image.menu
});
});
return imageListItems;
}
function recalcSize(e) {
var widthCtrl, heightCtrl, newWidth, newHeight;
widthCtrl = win.find('#width')[0];
heightCtrl = win.find('#height')[0];
newWidth = widthCtrl.value();
newHeight = heightCtrl.value();
if (win.find('#constrain')[0].checked() && width && height && newWidth && newHeight) {
if (e.control == widthCtrl) {
newHeight = Math.round((newWidth / width) * newHeight);
heightCtrl.value(newHeight);
} else {
newWidth = Math.round((newHeight / height) * newWidth);
widthCtrl.value(newWidth);
}
}
width = newWidth;
height = newHeight;
}
function onSubmitForm() {
function waitLoad(imgElm) {
function selectImage() {
imgElm.onload = imgElm.onerror = null;
editor.selection.select(imgElm);
editor.nodeChanged();
}
imgElm.onload = function() {
if (!data.width && !data.height) {
dom.setAttribs(imgElm, {
width: imgElm.clientWidth,
height: imgElm.clientHeight
});
//WP
editor.fire( 'wpNewImageRefresh', { node: imgElm } );
}
selectImage();
};
imgElm.onerror = selectImage;
}
var data = win.toJSON();
var caption = data.caption; // WP
if (data.width === '') {
data.width = null;
}
if (data.height === '') {
data.height = null;
}
if (data.style === '') {
data.style = null;
}
data = {
src: data.src,
alt: data.alt,
width: data.width,
height: data.height,
style: data.style
};
editor.undoManager.transact(function() {
// WP
var eventData = { node: imgElm, data: data, caption: caption };
editor.fire( 'wpImageFormSubmit', { imgData: eventData } );
if ( eventData.cancel ) {
waitLoad( eventData.node );
return;
}
// WP end
if (!data.src) {
if (imgElm) {
dom.remove(imgElm);
editor.nodeChanged();
}
return;
}
if (!imgElm) {
data.id = '__mcenew';
editor.selection.setContent(dom.createHTML('img', data));
imgElm = dom.get('__mcenew');
dom.setAttrib(imgElm, 'id', null);
} else {
dom.setAttribs(imgElm, data);
}
waitLoad(imgElm);
});
}
function removePixelSuffix(value) {
if (value) {
value = value.replace(/px$/, '');
}
return value;
}
function srcChange() {
if (imageListCtrl) {
imageListCtrl.value(editor.convertURL(this.value(), 'src'));
}
getImageSize(this.value(), function(data) {
if (data.width && data.height) {
width = data.width;
height = data.height;
win.find('#width').value(width);
win.find('#height').value(height);
}
});
}
width = dom.getAttrib(imgElm, 'width');
height = dom.getAttrib(imgElm, 'height');
if (imgElm.nodeName == 'IMG' && !imgElm.getAttribute('data-mce-object') && !imgElm.getAttribute('data-mce-placeholder')) {
data = {
src: dom.getAttrib(imgElm, 'src'),
alt: dom.getAttrib(imgElm, 'alt'),
width: width,
height: height
};
// WP
editor.fire( 'wpLoadImageData', { imgData: { data: data, node: imgElm } } );
} else {
imgElm = null;
}
if (imageList) {
imageListCtrl = {
type: 'listbox',
label: 'Image list',
values: buildImageList(),
value: data.src && editor.convertURL(data.src, 'src'),
onselect: function(e) {
var altCtrl = win.find('#alt');
if (!altCtrl.value() || (e.lastControl && altCtrl.value() == e.lastControl.text())) {
altCtrl.value(e.control.text());
}
win.find('#src').value(e.control.value());
},
onPostRender: function() {
imageListCtrl = this;
}
};
}
// General settings shared between simple and advanced dialogs
var generalFormItems = [
{name: 'src', type: 'filepicker', filetype: 'image', label: 'Source', autofocus: true, onchange: srcChange},
imageListCtrl,
{name: 'alt', type: 'textbox', label: 'Image description'},
{
type: 'container',
label: 'Dimensions',
layout: 'flex',
direction: 'row',
align: 'center',
spacing: 5,
items: [
{name: 'width', type: 'textbox', maxLength: 3, size: 3, onchange: recalcSize},
{type: 'label', text: 'x'},
{name: 'height', type: 'textbox', maxLength: 3, size: 3, onchange: recalcSize},
{name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions'}
]
}
];
// WP
editor.fire( 'wpLoadImageForm', { data: generalFormItems } );
function updateStyle() {
function addPixelSuffix(value) {
if (value.length > 0 && /^[0-9]+$/.test(value)) {
value += 'px';
}
return value;
}
var data = win.toJSON();
var css = dom.parseStyle(data.style);
delete css.margin;
css['margin-top'] = css['margin-bottom'] = addPixelSuffix(data.vspace);
css['margin-left'] = css['margin-right'] = addPixelSuffix(data.hspace);
css['border-width'] = addPixelSuffix(data.border);
win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
}
if (editor.settings.image_advtab) {
// Parse styles from img
if (imgElm) {
data.hspace = removePixelSuffix(imgElm.style.marginLeft || imgElm.style.marginRight);
data.vspace = removePixelSuffix(imgElm.style.marginTop || imgElm.style.marginBottom);
data.border = removePixelSuffix(imgElm.style.borderWidth);
data.style = editor.dom.serializeStyle(editor.dom.parseStyle(editor.dom.getAttrib(imgElm, 'style')));
}
// Advanced dialog shows general+advanced tabs
win = editor.windowManager.open({
title: 'Insert/edit image',
data: data,
bodyType: 'tabpanel',
body: [
{
title: 'General',
type: 'form',
items: generalFormItems
},
{
title: 'Advanced',
type: 'form',
pack: 'start',
items: [
{
label: 'Style',
name: 'style',
type: 'textbox'
},
{
type: 'form',
layout: 'grid',
packV: 'start',
columns: 2,
padding: 0,
alignH: ['left', 'right'],
defaults: {
type: 'textbox',
maxWidth: 50,
onchange: updateStyle
},
items: [
{label: 'Vertical space', name: 'vspace'},
{label: 'Horizontal space', name: 'hspace'},
{label: 'Border', name: 'border'}
]
}
]
}
],
onSubmit: onSubmitForm
});
} else {
// Simple default dialog
win = editor.windowManager.open({
title: 'Insert/edit image',
data: data,
body: generalFormItems,
onSubmit: onSubmitForm
});
}
}
// WP
editor.addCommand( 'mceImage', function() {
createImageList( showDialog )();
});
editor.addButton('image', {
icon: 'image',
tooltip: 'Insert/edit image',
onclick: createImageList(showDialog),
stateSelector: 'img:not([data-mce-object],[data-mce-placeholder])'
});
editor.addMenuItem('image', {
icon: 'image',
text: 'Insert image',
onclick: createImageList(showDialog),
context: 'insert',
prependToContext: true
});
});

View File

@ -0,0 +1 @@
tinymce.PluginManager.add("image",function(a){function b(a,b){function c(a,c){d.parentNode.removeChild(d),b({width:a,height:c})}var d=document.createElement("img");d.onload=function(){c(d.clientWidth,d.clientHeight)},d.onerror=function(){c()},d.src=a;var e=d.style;e.visibility="hidden",e.position="fixed",e.bottom=e.left=0,e.width=e.height="auto",document.body.appendChild(d)}function c(b){return function(){var c=a.settings.image_list;"string"==typeof c?tinymce.util.XHR.send({url:c,success:function(a){b(tinymce.util.JSON.parse(a))}}):b(c)}}function d(c){function d(){var b=[{text:"None",value:""}];return tinymce.each(c,function(c){b.push({text:c.text||c.title,value:a.convertURL(c.value||c.url,"src"),menu:c.menu})}),b}function e(a){var b,c,d,e;b=j.find("#width")[0],c=j.find("#height")[0],d=b.value(),e=c.value(),j.find("#constrain")[0].checked()&&k&&l&&d&&e&&(a.control==b?(e=Math.round(d/k*e),c.value(e)):(d=Math.round(e/l*d),b.value(d))),k=d,l=e}function f(){function b(b){function d(){b.onload=b.onerror=null,a.selection.select(b),a.nodeChanged()}b.onload=function(){c.width||c.height||(o.setAttribs(b,{width:b.clientWidth,height:b.clientHeight}),a.fire("wpNewImageRefresh",{node:b})),d()},b.onerror=d}var c=j.toJSON(),d=c.caption;""===c.width&&(c.width=null),""===c.height&&(c.height=null),""===c.style&&(c.style=null),c={src:c.src,alt:c.alt,width:c.width,height:c.height,style:c.style},a.undoManager.transact(function(){var e={node:p,data:c,caption:d};return a.fire("wpImageFormSubmit",{imgData:e}),e.cancel?(b(e.node),void 0):c.src?(p?o.setAttribs(p,c):(c.id="__mcenew",a.selection.setContent(o.createHTML("img",c)),p=o.get("__mcenew"),o.setAttrib(p,"id",null)),b(p),void 0):(p&&(o.remove(p),a.nodeChanged()),void 0)})}function g(a){return a&&(a=a.replace(/px$/,"")),a}function h(){m&&m.value(a.convertURL(this.value(),"src")),b(this.value(),function(a){a.width&&a.height&&(k=a.width,l=a.height,j.find("#width").value(k),j.find("#height").value(l))})}function i(){function a(a){return a.length>0&&/^[0-9]+$/.test(a)&&(a+="px"),a}var b=j.toJSON(),c=o.parseStyle(b.style);delete c.margin,c["margin-top"]=c["margin-bottom"]=a(b.vspace),c["margin-left"]=c["margin-right"]=a(b.hspace),c["border-width"]=a(b.border),j.find("#style").value(o.serializeStyle(o.parseStyle(o.serializeStyle(c))))}var j,k,l,m,n={},o=a.dom,p=a.selection.getNode();k=o.getAttrib(p,"width"),l=o.getAttrib(p,"height"),"IMG"!=p.nodeName||p.getAttribute("data-mce-object")||p.getAttribute("data-mce-placeholder")?p=null:(n={src:o.getAttrib(p,"src"),alt:o.getAttrib(p,"alt"),width:k,height:l},a.fire("wpLoadImageData",{imgData:{data:n,node:p}})),c&&(m={type:"listbox",label:"Image list",values:d(),value:n.src&&a.convertURL(n.src,"src"),onselect:function(a){var b=j.find("#alt");(!b.value()||a.lastControl&&b.value()==a.lastControl.text())&&b.value(a.control.text()),j.find("#src").value(a.control.value())},onPostRender:function(){m=this}});var q=[{name:"src",type:"filepicker",filetype:"image",label:"Source",autofocus:!0,onchange:h},m,{name:"alt",type:"textbox",label:"Image description"},{type:"container",label:"Dimensions",layout:"flex",direction:"row",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:3,size:3,onchange:e},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:3,size:3,onchange:e},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}];a.fire("wpLoadImageForm",{data:q}),a.settings.image_advtab?(p&&(n.hspace=g(p.style.marginLeft||p.style.marginRight),n.vspace=g(p.style.marginTop||p.style.marginBottom),n.border=g(p.style.borderWidth),n.style=a.dom.serializeStyle(a.dom.parseStyle(a.dom.getAttrib(p,"style")))),j=a.windowManager.open({title:"Insert/edit image",data:n,bodyType:"tabpanel",body:[{title:"General",type:"form",items:q},{title:"Advanced",type:"form",pack:"start",items:[{label:"Style",name:"style",type:"textbox"},{type:"form",layout:"grid",packV:"start",columns:2,padding:0,alignH:["left","right"],defaults:{type:"textbox",maxWidth:50,onchange:i},items:[{label:"Vertical space",name:"vspace"},{label:"Horizontal space",name:"hspace"},{label:"Border",name:"border"}]}]}],onSubmit:f})):j=a.windowManager.open({title:"Insert/edit image",data:n,body:q,onSubmit:f})}a.addCommand("mceImage",function(){c(d)()}),a.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:c(d),stateSelector:"img:not([data-mce-object],[data-mce-placeholder])"}),a.addMenuItem("image",{icon:"image",text:"Insert image",onclick:c(d),context:"insert",prependToContext:!0})});

File diff suppressed because one or more lines are too long

View File

@ -1,699 +0,0 @@
/**
* editor_plugin_src.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
var DOM = tinymce.DOM, Element = tinymce.dom.Element, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is;
tinymce.create('tinymce.plugins.InlinePopups', {
init : function(ed, url) {
// Replace window manager
ed.onBeforeRenderUI.add(function() {
ed.windowManager = new tinymce.InlineWindowManager(ed);
DOM.loadCSS(url + '/skins/' + (ed.settings.inlinepopups_skin || 'clearlooks2') + "/window.css");
});
},
getInfo : function() {
return {
longname : 'InlinePopups',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',
version : tinymce.majorVersion + "." + tinymce.minorVersion
};
}
});
tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager', {
InlineWindowManager : function(ed) {
var t = this;
t.parent(ed);
t.zIndex = 300000;
t.count = 0;
t.windows = {};
},
open : function(f, p) {
var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w, u, parentWindow;
f = f || {};
p = p || {};
// Run native windows
if (!f.inline)
return t.parent(f, p);
parentWindow = t._frontWindow();
if (parentWindow && DOM.get(parentWindow.id + '_ifr')) {
parentWindow.focussedElement = DOM.get(parentWindow.id + '_ifr').contentWindow.document.activeElement;
}
// Only store selection if the type is a normal window
if (!f.type)
t.bookmark = ed.selection.getBookmark(1);
id = DOM.uniqueId();
vp = DOM.getViewPort();
f.width = parseInt(f.width || 320);
f.height = parseInt(f.height || 240) + (tinymce.isIE ? 8 : 0);
f.min_width = parseInt(f.min_width || 150);
f.min_height = parseInt(f.min_height || 100);
f.max_width = parseInt(f.max_width || 2000);
f.max_height = parseInt(f.max_height || 2000);
f.left = f.left || Math.round(Math.max(vp.x, vp.x + (vp.w / 2.0) - (f.width / 2.0)));
f.top = f.top || Math.round(Math.max(vp.y, vp.y + (vp.h / 2.0) - (f.height / 2.0)));
f.movable = f.resizable = true;
p.mce_width = f.width;
p.mce_height = f.height;
p.mce_inline = true;
p.mce_window_id = id;
p.mce_auto_focus = f.auto_focus;
// Transpose
// po = DOM.getPos(ed.getContainer());
// f.left -= po.x;
// f.top -= po.y;
t.features = f;
t.params = p;
t.onOpen.dispatch(t, f, p);
if (f.type) {
opt += ' mceModal';
if (f.type)
opt += ' mce' + f.type.substring(0, 1).toUpperCase() + f.type.substring(1);
f.resizable = false;
}
if (f.statusbar)
opt += ' mceStatusbar';
if (f.resizable)
opt += ' mceResizable';
if (f.minimizable)
opt += ' mceMinimizable';
if (f.maximizable)
opt += ' mceMaximizable';
if (f.movable)
opt += ' mceMovable';
// Create DOM objects
t._addAll(DOM.doc.body,
['div', {id : id, role : 'dialog', 'aria-labelledby': f.type ? id + '_content' : id + '_title', 'class' : (ed.settings.inlinepopups_skin || 'clearlooks2') + (tinymce.isIE && window.getSelection ? ' ie9' : ''), style : 'width:100px;height:100px'},
['div', {id : id + '_wrapper', 'class' : 'mceWrapper' + opt},
['div', {id : id + '_top', 'class' : 'mceTop'},
['div', {'class' : 'mceLeft'}],
['div', {'class' : 'mceCenter'}],
['div', {'class' : 'mceRight'}],
['span', {id : id + '_title'}, f.title || '']
],
['div', {id : id + '_middle', 'class' : 'mceMiddle'},
['div', {id : id + '_left', 'class' : 'mceLeft', tabindex : '0'}],
['span', {id : id + '_content'}],
['div', {id : id + '_right', 'class' : 'mceRight', tabindex : '0'}]
],
['div', {id : id + '_bottom', 'class' : 'mceBottom'},
['div', {'class' : 'mceLeft'}],
['div', {'class' : 'mceCenter'}],
['div', {'class' : 'mceRight'}],
['span', {id : id + '_status'}, 'Content']
],
['a', {'class' : 'mceMove', tabindex : '-1', href : 'javascript:;'}],
['a', {'class' : 'mceMin', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
['a', {'class' : 'mceMax', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
['a', {'class' : 'mceMed', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
['a', {'class' : 'mceClose', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
['a', {id : id + '_resize_n', 'class' : 'mceResize mceResizeN', tabindex : '-1', href : 'javascript:;'}],
['a', {id : id + '_resize_s', 'class' : 'mceResize mceResizeS', tabindex : '-1', href : 'javascript:;'}],
['a', {id : id + '_resize_w', 'class' : 'mceResize mceResizeW', tabindex : '-1', href : 'javascript:;'}],
['a', {id : id + '_resize_e', 'class' : 'mceResize mceResizeE', tabindex : '-1', href : 'javascript:;'}],
['a', {id : id + '_resize_nw', 'class' : 'mceResize mceResizeNW', tabindex : '-1', href : 'javascript:;'}],
['a', {id : id + '_resize_ne', 'class' : 'mceResize mceResizeNE', tabindex : '-1', href : 'javascript:;'}],
['a', {id : id + '_resize_sw', 'class' : 'mceResize mceResizeSW', tabindex : '-1', href : 'javascript:;'}],
['a', {id : id + '_resize_se', 'class' : 'mceResize mceResizeSE', tabindex : '-1', href : 'javascript:;'}]
]
]
);
DOM.setStyles(id, {top : -10000, left : -10000});
// Fix gecko rendering bug, where the editors iframe messed with window contents
if (tinymce.isGecko)
DOM.setStyle(id, 'overflow', 'auto');
// Measure borders
if (!f.type) {
dw += DOM.get(id + '_left').clientWidth;
dw += DOM.get(id + '_right').clientWidth;
dh += DOM.get(id + '_top').clientHeight;
dh += DOM.get(id + '_bottom').clientHeight;
}
// Resize window
DOM.setStyles(id, {top : f.top, left : f.left, width : f.width + dw, height : f.height + dh});
u = f.url || f.file;
if (u) {
if (tinymce.relaxedDomain)
u += (u.indexOf('?') == -1 ? '?' : '&') + 'mce_rdomain=' + tinymce.relaxedDomain;
u = tinymce._addVer(u);
}
if (!f.type) {
DOM.add(id + '_content', 'iframe', {id : id + '_ifr', src : 'javascript:""', frameBorder : 0, style : 'border:0;width:10px;height:10px'});
DOM.setStyles(id + '_ifr', {width : f.width, height : f.height});
DOM.setAttrib(id + '_ifr', 'src', u);
} else {
DOM.add(id + '_wrapper', 'a', {id : id + '_ok', 'class' : 'mceButton mceOk', href : 'javascript:;', onmousedown : 'return false;'}, 'Ok');
if (f.type == 'confirm')
DOM.add(id + '_wrapper', 'a', {'class' : 'mceButton mceCancel', href : 'javascript:;', onmousedown : 'return false;'}, 'Cancel');
DOM.add(id + '_middle', 'div', {'class' : 'mceIcon'});
DOM.setHTML(id + '_content', f.content.replace('\n', '<br />'));
Event.add(id, 'keyup', function(evt) {
var VK_ESCAPE = 27;
if (evt.keyCode === VK_ESCAPE) {
f.button_func(false);
return Event.cancel(evt);
}
});
Event.add(id, 'keydown', function(evt) {
var cancelButton, VK_TAB = 9;
if (evt.keyCode === VK_TAB) {
cancelButton = DOM.select('a.mceCancel', id + '_wrapper')[0];
if (cancelButton && cancelButton !== evt.target) {
cancelButton.focus();
} else {
DOM.get(id + '_ok').focus();
}
return Event.cancel(evt);
}
});
}
// Register events
mdf = Event.add(id, 'mousedown', function(e) {
var n = e.target, w, vp;
w = t.windows[id];
t.focus(id);
if (n.nodeName == 'A' || n.nodeName == 'a') {
if (n.className == 'mceClose') {
t.close(null, id);
return Event.cancel(e);
} else if (n.className == 'mceMax') {
w.oldPos = w.element.getXY();
w.oldSize = w.element.getSize();
vp = DOM.getViewPort();
// Reduce viewport size to avoid scrollbars
vp.w -= 2;
vp.h -= 2;
w.element.moveTo(vp.x, vp.y);
w.element.resizeTo(vp.w, vp.h);
DOM.setStyles(id + '_ifr', {width : vp.w - w.deltaWidth, height : vp.h - w.deltaHeight});
DOM.addClass(id + '_wrapper', 'mceMaximized');
} else if (n.className == 'mceMed') {
// Reset to old size
w.element.moveTo(w.oldPos.x, w.oldPos.y);
w.element.resizeTo(w.oldSize.w, w.oldSize.h);
w.iframeElement.resizeTo(w.oldSize.w - w.deltaWidth, w.oldSize.h - w.deltaHeight);
DOM.removeClass(id + '_wrapper', 'mceMaximized');
} else if (n.className == 'mceMove')
return t._startDrag(id, e, n.className);
else if (DOM.hasClass(n, 'mceResize'))
return t._startDrag(id, e, n.className.substring(13));
}
});
clf = Event.add(id, 'click', function(e) {
var n = e.target;
t.focus(id);
if (n.nodeName == 'A' || n.nodeName == 'a') {
switch (n.className) {
case 'mceClose':
t.close(null, id);
return Event.cancel(e);
case 'mceButton mceOk':
case 'mceButton mceCancel':
f.button_func(n.className == 'mceButton mceOk');
return Event.cancel(e);
}
}
});
// Make sure the tab order loops within the dialog.
Event.add([id + '_left', id + '_right'], 'focus', function(evt) {
var iframe = DOM.get(id + '_ifr');
if (iframe) {
var body = iframe.contentWindow.document.body;
var focusable = DOM.select(':input:enabled,*[tabindex=0]', body);
if (evt.target.id === (id + '_left')) {
focusable[focusable.length - 1].focus();
} else {
focusable[0].focus();
}
} else {
DOM.get(id + '_ok').focus();
}
});
// Add window
w = t.windows[id] = {
id : id,
mousedown_func : mdf,
click_func : clf,
element : new Element(id, {blocker : 1, container : ed.getContainer()}),
iframeElement : new Element(id + '_ifr'),
features : f,
deltaWidth : dw,
deltaHeight : dh
};
w.iframeElement.on('focus', function() {
t.focus(id);
});
// Setup blocker
if (t.count == 0 && t.editor.getParam('dialog_type', 'modal') == 'modal') {
DOM.add(DOM.doc.body, 'div', {
id : 'mceModalBlocker',
'class' : (t.editor.settings.inlinepopups_skin || 'clearlooks2') + '_modalBlocker',
style : {zIndex : t.zIndex - 1}
});
DOM.show('mceModalBlocker'); // Reduces flicker in IE
DOM.setAttrib(DOM.doc.body, 'aria-hidden', 'true');
} else
DOM.setStyle('mceModalBlocker', 'z-index', t.zIndex - 1);
if (tinymce.isIE6 || /Firefox\/2\./.test(navigator.userAgent) || (tinymce.isIE && !DOM.boxModel))
DOM.setStyles('mceModalBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2});
DOM.setAttrib(id, 'aria-hidden', 'false');
t.focus(id);
t._fixIELayout(id, 1);
// Focus ok button
if (DOM.get(id + '_ok'))
DOM.get(id + '_ok').focus();
t.count++;
return w;
},
focus : function(id) {
var t = this, w;
if (w = t.windows[id]) {
w.zIndex = this.zIndex++;
w.element.setStyle('zIndex', w.zIndex);
w.element.update();
id = id + '_wrapper';
DOM.removeClass(t.lastId, 'mceFocus');
DOM.addClass(id, 'mceFocus');
t.lastId = id;
if (w.focussedElement) {
w.focussedElement.focus();
} else if (DOM.get(id + '_ok')) {
DOM.get(w.id + '_ok').focus();
} else if (DOM.get(w.id + '_ifr')) {
DOM.get(w.id + '_ifr').focus();
}
}
},
_addAll : function(te, ne) {
var i, n, t = this, dom = tinymce.DOM;
if (is(ne, 'string'))
te.appendChild(dom.doc.createTextNode(ne));
else if (ne.length) {
te = te.appendChild(dom.create(ne[0], ne[1]));
for (i=2; i<ne.length; i++)
t._addAll(te, ne[i]);
}
},
_startDrag : function(id, se, ac) {
var t = this, mu, mm, d = DOM.doc, eb, w = t.windows[id], we = w.element, sp = we.getXY(), p, sz, ph, cp, vp, sx, sy, sex, sey, dx, dy, dw, dh;
// Get positons and sizes
// cp = DOM.getPos(t.editor.getContainer());
cp = {x : 0, y : 0};
vp = DOM.getViewPort();
// Reduce viewport size to avoid scrollbars while dragging
vp.w -= 2;
vp.h -= 2;
sex = se.screenX;
sey = se.screenY;
dx = dy = dw = dh = 0;
// Handle mouse up
mu = Event.add(d, 'mouseup', function(e) {
Event.remove(d, 'mouseup', mu);
Event.remove(d, 'mousemove', mm);
if (eb)
eb.remove();
we.moveBy(dx, dy);
we.resizeBy(dw, dh);
sz = we.getSize();
DOM.setStyles(id + '_ifr', {width : sz.w - w.deltaWidth, height : sz.h - w.deltaHeight});
t._fixIELayout(id, 1);
return Event.cancel(e);
});
if (ac != 'Move')
startMove();
function startMove() {
if (eb)
return;
t._fixIELayout(id, 0);
// Setup event blocker
DOM.add(d.body, 'div', {
id : 'mceEventBlocker',
'class' : 'mceEventBlocker ' + (t.editor.settings.inlinepopups_skin || 'clearlooks2'),
style : {zIndex : t.zIndex + 1}
});
if (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel))
DOM.setStyles('mceEventBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2});
eb = new Element('mceEventBlocker');
eb.update();
// Setup placeholder
p = we.getXY();
sz = we.getSize();
sx = cp.x + p.x - vp.x;
sy = cp.y + p.y - vp.y;
DOM.add(eb.get(), 'div', {id : 'mcePlaceHolder', 'class' : 'mcePlaceHolder', style : {left : sx, top : sy, width : sz.w, height : sz.h}});
ph = new Element('mcePlaceHolder');
};
// Handle mouse move/drag
mm = Event.add(d, 'mousemove', function(e) {
var x, y, v;
startMove();
x = e.screenX - sex;
y = e.screenY - sey;
switch (ac) {
case 'ResizeW':
dx = x;
dw = 0 - x;
break;
case 'ResizeE':
dw = x;
break;
case 'ResizeN':
case 'ResizeNW':
case 'ResizeNE':
if (ac == "ResizeNW") {
dx = x;
dw = 0 - x;
} else if (ac == "ResizeNE")
dw = x;
dy = y;
dh = 0 - y;
break;
case 'ResizeS':
case 'ResizeSW':
case 'ResizeSE':
if (ac == "ResizeSW") {
dx = x;
dw = 0 - x;
} else if (ac == "ResizeSE")
dw = x;
dh = y;
break;
case 'mceMove':
dx = x;
dy = y;
break;
}
// Boundary check
if (dw < (v = w.features.min_width - sz.w)) {
if (dx !== 0)
dx += dw - v;
dw = v;
}
if (dh < (v = w.features.min_height - sz.h)) {
if (dy !== 0)
dy += dh - v;
dh = v;
}
dw = Math.min(dw, w.features.max_width - sz.w);
dh = Math.min(dh, w.features.max_height - sz.h);
dx = Math.max(dx, vp.x - (sx + vp.x));
dy = Math.max(dy, vp.y - (sy + vp.y));
dx = Math.min(dx, (vp.w + vp.x) - (sx + sz.w + vp.x));
dy = Math.min(dy, (vp.h + vp.y) - (sy + sz.h + vp.y));
// Move if needed
if (dx + dy !== 0) {
if (sx + dx < 0)
dx = 0;
if (sy + dy < 0)
dy = 0;
ph.moveTo(sx + dx, sy + dy);
}
// Resize if needed
if (dw + dh !== 0)
ph.resizeTo(sz.w + dw, sz.h + dh);
return Event.cancel(e);
});
return Event.cancel(se);
},
resizeBy : function(dw, dh, id) {
var w = this.windows[id];
if (w) {
w.element.resizeBy(dw, dh);
w.iframeElement.resizeBy(dw, dh);
}
},
close : function(win, id) {
var t = this, w, d = DOM.doc, fw, id;
id = t._findId(id || win);
// Probably not inline
if (!t.windows[id]) {
t.parent(win);
return;
}
t.count--;
if (t.count == 0) {
DOM.remove('mceModalBlocker');
DOM.setAttrib(DOM.doc.body, 'aria-hidden', 'false');
t.editor.focus();
}
if (w = t.windows[id]) {
t.onClose.dispatch(t);
Event.remove(d, 'mousedown', w.mousedownFunc);
Event.remove(d, 'click', w.clickFunc);
Event.clear(id);
Event.clear(id + '_ifr');
DOM.setAttrib(id + '_ifr', 'src', 'javascript:""'); // Prevent leak
w.element.remove();
delete t.windows[id];
fw = t._frontWindow();
if (fw)
t.focus(fw.id);
}
},
// Find front most window
_frontWindow : function() {
var fw, ix = 0;
// Find front most window and focus that
each (this.windows, function(w) {
if (w.zIndex > ix) {
fw = w;
ix = w.zIndex;
}
});
return fw;
},
setTitle : function(w, ti) {
var e;
w = this._findId(w);
if (e = DOM.get(w + '_title'))
e.innerHTML = DOM.encode(ti);
},
alert : function(txt, cb, s) {
var t = this, w;
w = t.open({
title : t,
type : 'alert',
button_func : function(s) {
if (cb)
cb.call(s || t, s);
t.close(null, w.id);
},
content : DOM.encode(t.editor.getLang(txt, txt)),
inline : 1,
width : 400,
height : 130
});
},
confirm : function(txt, cb, s) {
var t = this, w;
w = t.open({
title : t,
type : 'confirm',
button_func : function(s) {
if (cb)
cb.call(s || t, s);
t.close(null, w.id);
},
content : DOM.encode(t.editor.getLang(txt, txt)),
inline : 1,
width : 400,
height : 130
});
},
// Internal functions
_findId : function(w) {
var t = this;
if (typeof(w) == 'string')
return w;
each(t.windows, function(wo) {
var ifr = DOM.get(wo.id + '_ifr');
if (ifr && w == ifr.contentWindow) {
w = wo.id;
return false;
}
});
return w;
},
_fixIELayout : function(id, s) {
var w, img;
if (!tinymce.isIE6)
return;
// Fixes the bug where hover flickers and does odd things in IE6
each(['n','s','w','e','nw','ne','sw','se'], function(v) {
var e = DOM.get(id + '_resize_' + v);
DOM.setStyles(e, {
width : s ? e.clientWidth : '',
height : s ? e.clientHeight : '',
cursor : DOM.getStyle(e, 'cursor', 1)
});
DOM.setStyle(id + "_bottom", 'bottom', '-1px');
e = 0;
});
// Fixes graphics glitch
if (w = this.windows[id]) {
// Fixes rendering bug after resize
w.element.hide();
w.element.show();
// Forced a repaint of the window
//DOM.get(id).style.filter = '';
// IE has a bug where images used in CSS won't get loaded
// sometimes when the cache in the browser is disabled
// This fix tries to solve it by loading the images using the image object
each(DOM.select('div,a', id), function(e, i) {
if (e.currentStyle.backgroundImage != 'none') {
img = new Image();
img.src = e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/, '$1');
}
});
DOM.get(id).style.filter = '';
}
}
});
// Register plugin
tinymce.PluginManager.add('inlinepopups', tinymce.plugins.InlinePopups);
})();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 989 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 907 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 B

View File

@ -1,126 +0,0 @@
/* Clearlooks 2 */
/* Reset */
.clearlooks2, .clearlooks2 div, .clearlooks2 span, .clearlooks2 a {vertical-align:baseline; text-align:left; position:absolute; border:0; padding:0; margin:0; background:transparent; font-family:Arial,Verdana; font-size:11px; color:#000; text-decoration:none; font-weight:normal; width:auto; height:auto; overflow:hidden; display:block}
/* General */
.clearlooks2 {position:absolute; direction:ltr}
.clearlooks2 .mceWrapper {position:static}
.mceEventBlocker {position:fixed; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%}
.clearlooks2 .mcePlaceHolder {border:1px solid #000; background:#888; top:0; left:0; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50)}
.clearlooks2_modalBlocker {position:fixed; left:0; top:0; width:100%; height:100%; background:#FFF; opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60); display:none}
/* Top */
.clearlooks2 .mceTop,
.clearlooks2 .mceTop div {
top:0;
width:100%;
height:23px
}
.clearlooks2 .mceTop .mceLeft {
width:55%;
background-image: none;
border-style: solid none none solid;
border-width: 1px;
}
.clearlooks2 .mceTop .mceCenter {
}
.clearlooks2 .mceTop .mceRight {
right:0;
width:55%;
height:23px;
background-image: none;
border-style: solid solid none none;
border-width: 1px;
}
.clearlooks2 .mceTop span {
width:100%;
font: 12px/20px bold "Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif;
text-align:center;
vertical-align:middle;
line-height:23px;
font-weight:bold;
}
.clearlooks2 .mceFocus .mceTop .mceLeft {
background-image: none;
border-style: solid none none solid;
border-width: 1px;
}
.clearlooks2 .mceFocus .mceTop .mceCenter {
}
.clearlooks2 .mceFocus .mceTop .mceRight {
background-image: none;
border-style: solid solid none none;
border-width: 1px;
}
.clearlooks2 .mceFocus .mceTop span {
color:#FFF
}
/* Middle */
.clearlooks2 .mceMiddle, .clearlooks2 .mceMiddle div {top:0}
.clearlooks2 .mceMiddle {width:100%; height:100%; clip:rect(23px auto auto auto)}
.clearlooks2 .mceMiddle .mceLeft {left:0; width:5px; height:100%; background:#E4F2FD;border-left:1px solid #c6d9e9}
.clearlooks2 .mceMiddle span {top:23px; left:5px; width:100%; height:100%; background:#FFF}
.clearlooks2 .mceMiddle .mceRight {right:0; width:5px; height:100%; background:#E4F2FD;border-right:1px solid #c6d9e9}
/* Bottom */
.clearlooks2 .mceBottom, .clearlooks2 .mceBottom div {height:6px}
.clearlooks2 .mceBottom {left:0; bottom:0; width:100%;background:#E4F2FD;border-bottom:1px solid #c6d9e9}
.clearlooks2 .mceBottom div {top:0}
.clearlooks2 .mceBottom .mceLeft {left:0; width:5px; background:#E4F2FD ;border-left:1px solid #c6d9e9}
.clearlooks2 .mceBottom .mceCenter {left:5px; width:100%}
.clearlooks2 .mceBottom .mceRight {right:0; width:6px; background:#E4F2FD url(img/drag.gif) no-repeat;border-right:1px solid #c6d9e9}
.clearlooks2 .mceBottom span {display:none}
.clearlooks2 .mceStatusbar .mceBottom, .clearlooks2 .mceStatusbar .mceBottom div {height:23px}
.clearlooks2 .mceStatusbar .mceBottom .mceLeft {background:url(img/corners.gif) -29px 0}
.clearlooks2 .mceStatusbar .mceBottom .mceCenter {background:url(img/horizontal.gif) 0 -52px}
.clearlooks2 .mceStatusbar .mceBottom .mceRight {background:url(img/corners.gif) -24px 0}
.clearlooks2 .mceStatusbar .mceBottom span {display:block; left:7px; font-family:Arial, Verdana; font-size:11px; line-height:23px}
/* Actions */
.clearlooks2 a {width:29px; height:16px; top:3px;}
.clearlooks2 .mceClose {right:6px; background:url(img/buttons.gif) -87px 0}
.clearlooks2 .mceMin {display:none; right:68px; background:url(img/buttons.gif) 0 0}
.clearlooks2 .mceMed {display:none; right:37px; background:url(img/buttons.gif) -29px 0}
.clearlooks2 .mceMax {display:none; right:37px; background:url(img/buttons.gif) -58px 0}
.clearlooks2 .mceMove {display:none;width:100%;cursor:move;background:url(img/corners.gif) no-repeat -100px -100px}
.clearlooks2 .mceMovable .mceMove {display:block}
.clearlooks2 .mceFocus .mceClose {right:6px; background:url(img/buttons.gif) -87px -16px}
.clearlooks2 .mceFocus .mceMin {right:68px; background:url(img/buttons.gif) 0 -16px}
.clearlooks2 .mceFocus .mceMed {right:37px; background:url(img/buttons.gif) -29px -16px}
.clearlooks2 .mceFocus .mceMax {right:37px; background:url(img/buttons.gif) -58px -16px}
.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px}
.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px}
.clearlooks2 .mceFocus .mceMin:hover {right:68px; background:url(img/buttons.gif) 0 -32px}
.clearlooks2 .mceFocus .mceMed:hover {right:37px; background:url(img/buttons.gif) -29px -32px}
.clearlooks2 .mceFocus .mceMax:hover {right:37px; background:url(img/buttons.gif) -58px -32px}
/* Resize */
.clearlooks2 .mceResize {top:auto; left:auto; display:none; width:5px; height:5px; background:url(img/horizontal.gif) no-repeat 0 -75px}
.clearlooks2 .mceResizable .mceResize {display:block}
.clearlooks2 .mceResizable .mceMin, .clearlooks2 .mceMax {display:none}
.clearlooks2 .mceMinimizable .mceMin {display:block}
.clearlooks2 .mceMaximizable .mceMax {display:block}
.clearlooks2 .mceMaximized .mceMed {display:block}
.clearlooks2 .mceMaximized .mceMax {display:none}
.clearlooks2 a.mceResizeN {top:0; left:0; width:100%; cursor:n-resize}
.clearlooks2 a.mceResizeNW {top:0; left:0; cursor:nw-resize}
.clearlooks2 a.mceResizeNE {top:0; right:0; cursor:ne-resize}
.clearlooks2 a.mceResizeW {top:0; left:0; height:100%; cursor:w-resize;}
.clearlooks2 a.mceResizeE {top:0; right:0; height:100%; cursor:e-resize}
.clearlooks2 a.mceResizeS {bottom:0; left:0; width:100%; cursor:s-resize}
.clearlooks2 a.mceResizeSW {bottom:0; left:0; cursor:sw-resize}
.clearlooks2 a.mceResizeSE {bottom:0; right:0; cursor:se-resize}
/* Alert/Confirm */
.clearlooks2 .mceButton {font-weight:bold; bottom:10px; width:80px; height:30px; background:url(img/button.gif); line-height:30px; vertical-align:middle; text-align:center; outline:0}
.clearlooks2 .mceMiddle .mceIcon {left:15px; top:35px; width:32px; height:32px}
.clearlooks2 .mceAlert .mceMiddle span, .clearlooks2 .mceConfirm .mceMiddle span {background:transparent;left:60px; top:35px; width:320px; height:50px; font-weight:bold; overflow:auto; white-space:normal}
.clearlooks2 a:hover {font-weight:bold;}
.clearlooks2 .mceAlert .mceMiddle, .clearlooks2 .mceConfirm .mceMiddle {background:#F9F9F9}
.clearlooks2 .mceAlert .mceOk {left:50%; top:auto; margin-left: -40px}
.clearlooks2 .mceAlert .mceIcon {background:url(img/alert.gif)}
.clearlooks2 .mceConfirm .mceOk {left:50%; top:auto; margin-left: -90px}
.clearlooks2 .mceConfirm .mceCancel {left:50%; top:auto}
.clearlooks2 .mceConfirm .mceIcon {background:url(img/confirm.gif)}

View File

@ -1,387 +0,0 @@
<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Template for dialogs</title>
<link rel="stylesheet" type="text/css" href="skins/clearlooks2/window.css?ver=359-20131010" />
</head>
<body>
<div class="mceEditor">
<div class="clearlooks2" style="width:400px; height:100px; left:10px;">
<div class="mceWrapper">
<div class="mceTop">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Blured</span>
</div>
<div class="mceMiddle">
<div class="mceLeft"></div>
<span>Content</span>
<div class="mceRight"></div>
</div>
<div class="mceBottom">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Statusbar text.</span>
</div>
<a class="mceMove" href="#"></a>
<a class="mceMin" href="#"></a>
<a class="mceMax" href="#"></a>
<a class="mceMed" href="#"></a>
<a class="mceClose" href="#"></a>
<a class="mceResize mceResizeN" href="#"></a>
<a class="mceResize mceResizeS" href="#"></a>
<a class="mceResize mceResizeW" href="#"></a>
<a class="mceResize mceResizeE" href="#"></a>
<a class="mceResize mceResizeNW" href="#"></a>
<a class="mceResize mceResizeNE" href="#"></a>
<a class="mceResize mceResizeSW" href="#"></a>
<a class="mceResize mceResizeSE" href="#"></a>
</div>
</div>
<div class="clearlooks2" style="width:400px; height:100px; left:420px;">
<div class="mceWrapper mceMovable mceFocus">
<div class="mceTop">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Focused</span>
</div>
<div class="mceMiddle">
<div class="mceLeft"></div>
<span>Content</span>
<div class="mceRight"></div>
</div>
<div class="mceBottom">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Statusbar text.</span>
</div>
<a class="mceMove" href="#"></a>
<a class="mceMin" href="#"></a>
<a class="mceMax" href="#"></a>
<a class="mceMed" href="#"></a>
<a class="mceClose" href="#"></a>
<a class="mceResize mceResizeN" href="#"></a>
<a class="mceResize mceResizeS" href="#"></a>
<a class="mceResize mceResizeW" href="#"></a>
<a class="mceResize mceResizeE" href="#"></a>
<a class="mceResize mceResizeNW" href="#"></a>
<a class="mceResize mceResizeNE" href="#"></a>
<a class="mceResize mceResizeSW" href="#"></a>
<a class="mceResize mceResizeSE" href="#"></a>
</div>
</div>
<div class="clearlooks2" style="width:400px; height:100px; left:10px; top:120px;">
<div class="mceWrapper mceMovable mceFocus mceStatusbar">
<div class="mceTop">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Statusbar</span>
</div>
<div class="mceMiddle">
<div class="mceLeft"></div>
<span>Content</span>
<div class="mceRight"></div>
</div>
<div class="mceBottom">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Statusbar text.</span>
</div>
<a class="mceMove" href="#"></a>
<a class="mceMin" href="#"></a>
<a class="mceMax" href="#"></a>
<a class="mceMed" href="#"></a>
<a class="mceClose" href="#"></a>
<a class="mceResize mceResizeN" href="#"></a>
<a class="mceResize mceResizeS" href="#"></a>
<a class="mceResize mceResizeW" href="#"></a>
<a class="mceResize mceResizeE" href="#"></a>
<a class="mceResize mceResizeNW" href="#"></a>
<a class="mceResize mceResizeNE" href="#"></a>
<a class="mceResize mceResizeSW" href="#"></a>
<a class="mceResize mceResizeSE" href="#"></a>
</div>
</div>
<div class="clearlooks2" style="width:400px; height:100px; left:420px; top:120px;">
<div class="mceWrapper mceMovable mceFocus mceStatusbar mceResizable">
<div class="mceTop">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Statusbar, Resizable</span>
</div>
<div class="mceMiddle">
<div class="mceLeft"></div>
<span>Content</span>
<div class="mceRight"></div>
</div>
<div class="mceBottom">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Statusbar text.</span>
</div>
<a class="mceMove" href="#"></a>
<a class="mceMin" href="#"></a>
<a class="mceMax" href="#"></a>
<a class="mceMed" href="#"></a>
<a class="mceClose" href="#"></a>
<a class="mceResize mceResizeN" href="#"></a>
<a class="mceResize mceResizeS" href="#"></a>
<a class="mceResize mceResizeW" href="#"></a>
<a class="mceResize mceResizeE" href="#"></a>
<a class="mceResize mceResizeNW" href="#"></a>
<a class="mceResize mceResizeNE" href="#"></a>
<a class="mceResize mceResizeSW" href="#"></a>
<a class="mceResize mceResizeSE" href="#"></a>
</div>
</div>
<div class="clearlooks2" style="width:400px; height:100px; left:10px; top:230px;">
<div class="mceWrapper mceMovable mceFocus mceResizable mceMaximizable">
<div class="mceTop">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Resizable, Maximizable</span>
</div>
<div class="mceMiddle">
<div class="mceLeft"></div>
<span>Content</span>
<div class="mceRight"></div>
</div>
<div class="mceBottom">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Statusbar text.</span>
</div>
<a class="mceMove" href="#"></a>
<a class="mceMin" href="#"></a>
<a class="mceMax" href="#"></a>
<a class="mceMed" href="#"></a>
<a class="mceClose" href="#"></a>
<a class="mceResize mceResizeN" href="#"></a>
<a class="mceResize mceResizeS" href="#"></a>
<a class="mceResize mceResizeW" href="#"></a>
<a class="mceResize mceResizeE" href="#"></a>
<a class="mceResize mceResizeNW" href="#"></a>
<a class="mceResize mceResizeNE" href="#"></a>
<a class="mceResize mceResizeSW" href="#"></a>
<a class="mceResize mceResizeSE" href="#"></a>
</div>
</div>
<div class="clearlooks2" style="width:400px; height:100px; left:420px; top:230px;">
<div class="mceWrapper mceMovable mceStatusbar mceResizable mceMaximizable">
<div class="mceTop">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Blurred, Maximizable, Statusbar, Resizable</span>
</div>
<div class="mceMiddle">
<div class="mceLeft"></div>
<span>Content</span>
<div class="mceRight"></div>
</div>
<div class="mceBottom">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Statusbar text.</span>
</div>
<a class="mceMove" href="#"></a>
<a class="mceMin" href="#"></a>
<a class="mceMax" href="#"></a>
<a class="mceMed" href="#"></a>
<a class="mceClose" href="#"></a>
<a class="mceResize mceResizeN" href="#"></a>
<a class="mceResize mceResizeS" href="#"></a>
<a class="mceResize mceResizeW" href="#"></a>
<a class="mceResize mceResizeE" href="#"></a>
<a class="mceResize mceResizeNW" href="#"></a>
<a class="mceResize mceResizeNE" href="#"></a>
<a class="mceResize mceResizeSW" href="#"></a>
<a class="mceResize mceResizeSE" href="#"></a>
</div>
</div>
<div class="clearlooks2" style="width:400px; height:100px; left:10px; top:340px;">
<div class="mceWrapper mceMovable mceFocus mceResizable mceMaximized mceMinimizable mceMaximizable">
<div class="mceTop">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Maximized, Maximizable, Minimizable</span>
</div>
<div class="mceMiddle">
<div class="mceLeft"></div>
<span>Content</span>
<div class="mceRight"></div>
</div>
<div class="mceBottom">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Statusbar text.</span>
</div>
<a class="mceMove" href="#"></a>
<a class="mceMin" href="#"></a>
<a class="mceMax" href="#"></a>
<a class="mceMed" href="#"></a>
<a class="mceClose" href="#"></a>
<a class="mceResize mceResizeN" href="#"></a>
<a class="mceResize mceResizeS" href="#"></a>
<a class="mceResize mceResizeW" href="#"></a>
<a class="mceResize mceResizeE" href="#"></a>
<a class="mceResize mceResizeNW" href="#"></a>
<a class="mceResize mceResizeNE" href="#"></a>
<a class="mceResize mceResizeSW" href="#"></a>
<a class="mceResize mceResizeSE" href="#"></a>
</div>
</div>
<div class="clearlooks2" style="width:400px; height:100px; left:420px; top:340px;">
<div class="mceWrapper mceMovable mceStatusbar mceResizable mceMaximized mceMinimizable mceMaximizable">
<div class="mceTop">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Blured</span>
</div>
<div class="mceMiddle">
<div class="mceLeft"></div>
<span>Content</span>
<div class="mceRight"></div>
</div>
<div class="mceBottom">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Statusbar text.</span>
</div>
<a class="mceMove" href="#"></a>
<a class="mceMin" href="#"></a>
<a class="mceMax" href="#"></a>
<a class="mceMed" href="#"></a>
<a class="mceClose" href="#"></a>
<a class="mceResize mceResizeN" href="#"></a>
<a class="mceResize mceResizeS" href="#"></a>
<a class="mceResize mceResizeW" href="#"></a>
<a class="mceResize mceResizeE" href="#"></a>
<a class="mceResize mceResizeNW" href="#"></a>
<a class="mceResize mceResizeNE" href="#"></a>
<a class="mceResize mceResizeSW" href="#"></a>
<a class="mceResize mceResizeSE" href="#"></a>
</div>
</div>
<div class="clearlooks2" style="width:400px; height:130px; left:10px; top:450px;">
<div class="mceWrapper mceMovable mceFocus mceModal mceAlert">
<div class="mceTop">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Alert</span>
</div>
<div class="mceMiddle">
<div class="mceLeft"></div>
<span>
This is a very long error message. This is a very long error message.
This is a very long error message. This is a very long error message.
This is a very long error message. This is a very long error message.
This is a very long error message. This is a very long error message.
This is a very long error message. This is a very long error message.
This is a very long error message. This is a very long error message.
</span>
<div class="mceRight"></div>
<div class="mceIcon"></div>
</div>
<div class="mceBottom">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
</div>
<a class="mceMove" href="#"></a>
<a class="mceButton mceOk" href="#">Ok</a>
<a class="mceClose" href="#"></a>
</div>
</div>
<div class="clearlooks2" style="width:400px; height:130px; left:420px; top:450px;">
<div class="mceWrapper mceMovable mceFocus mceModal mceConfirm">
<div class="mceTop">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
<span>Confirm</span>
</div>
<div class="mceMiddle">
<div class="mceLeft"></div>
<span>
This is a very long error message. This is a very long error message.
This is a very long error message. This is a very long error message.
This is a very long error message. This is a very long error message.
This is a very long error message. This is a very long error message.
This is a very long error message. This is a very long error message.
This is a very long error message. This is a very long error message.
</span>
<div class="mceRight"></div>
<div class="mceIcon"></div>
</div>
<div class="mceBottom">
<div class="mceLeft"></div>
<div class="mceCenter"></div>
<div class="mceRight"></div>
</div>
<a class="mceMove" href="#"></a>
<a class="mceButton mceOk" href="#">Ok</a>
<a class="mceButton mceCancel" href="#">Cancel</a>
<a class="mceClose" href="#"></a>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,308 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('link', function(editor) {
function createLinkList(callback) {
return function() {
var linkList = editor.settings.link_list;
if (typeof(linkList) == "string") {
tinymce.util.XHR.send({
url: linkList,
success: function(text) {
callback(tinymce.util.JSON.parse(text));
}
});
} else {
callback(linkList);
}
};
}
function showDialog(linkList) {
var data = {}, selection = editor.selection, dom = editor.dom, selectedElm, anchorElm, initialText;
var win, linkListCtrl, relListCtrl, targetListCtrl;
function linkListChangeHandler(e) {
var textCtrl = win.find('#text');
if (!textCtrl.value() || (e.lastControl && textCtrl.value() == e.lastControl.text())) {
textCtrl.value(e.control.text());
}
win.find('#href').value(e.control.value());
}
function buildLinkList() {
var linkListItems = [{text: 'None', value: ''}];
tinymce.each(linkList, function(link) {
linkListItems.push({
text: link.text || link.title,
value: editor.convertURL(link.value || link.url, 'href'),
menu: link.menu
});
});
return linkListItems;
}
function buildRelList(relValue) {
var relListItems = [{text: 'None', value: ''}];
tinymce.each(editor.settings.rel_list, function(rel) {
relListItems.push({
text: rel.text || rel.title,
value: rel.value,
selected: relValue === rel.value
});
});
return relListItems;
}
function buildTargetList(targetValue) {
var targetListItems = [{text: 'None', value: ''}];
if (!editor.settings.target_list) {
targetListItems.push({text: 'New window', value: '_blank'});
}
tinymce.each(editor.settings.target_list, function(target) {
targetListItems.push({
text: target.text || target.title,
value: target.value,
selected: targetValue === target.value
});
});
return targetListItems;
}
function buildAnchorListControl(url) {
var anchorList = [];
tinymce.each(editor.dom.select('a:not([href])'), function(anchor) {
var id = anchor.name || anchor.id;
if (id) {
anchorList.push({
text: id,
value: '#' + id,
selected: url.indexOf('#' + id) != -1
});
}
});
if (anchorList.length) {
anchorList.unshift({text: 'None', value: ''});
return {
name: 'anchor',
type: 'listbox',
label: 'Anchors',
values: anchorList,
onselect: linkListChangeHandler
};
}
}
function urlChange() {
if (linkListCtrl) {
linkListCtrl.value(editor.convertURL(this.value(), 'href'));
}
if (!initialText && data.text.length === 0) {
this.parent().parent().find('#text')[0].value(this.value());
}
}
selectedElm = selection.getNode();
anchorElm = dom.getParent(selectedElm, 'a[href]');
data.text = initialText = anchorElm ? (anchorElm.innerText || anchorElm.textContent) : selection.getContent({format: 'text'});
data.href = anchorElm ? dom.getAttrib(anchorElm, 'href') : '';
data.target = anchorElm ? dom.getAttrib(anchorElm, 'target') : '';
data.rel = anchorElm ? dom.getAttrib(anchorElm, 'rel') : '';
if (selectedElm.nodeName == "IMG") {
data.text = initialText = " ";
}
if (linkList) {
linkListCtrl = {
type: 'listbox',
label: 'Link list',
values: buildLinkList(),
onselect: linkListChangeHandler,
value: editor.convertURL(data.href, 'href'),
onPostRender: function() {
linkListCtrl = this;
}
};
}
if (editor.settings.target_list !== false) {
targetListCtrl = {
name: 'target',
type: 'listbox',
label: 'Target',
values: buildTargetList(data.target)
};
}
if (editor.settings.rel_list) {
relListCtrl = {
name: 'rel',
type: 'listbox',
label: 'Rel',
values: buildRelList(data.rel)
};
}
win = editor.windowManager.open({
title: 'Insert link',
data: data,
body: [
{
name: 'href',
type: 'filepicker',
filetype: 'file',
size: 40,
autofocus: true,
label: 'Url',
onchange: urlChange,
onkeyup: urlChange
},
{name: 'text', type: 'textbox', size: 40, label: 'Text to display', onchange: function() {
data.text = this.value();
}},
buildAnchorListControl(data.href),
linkListCtrl,
relListCtrl,
targetListCtrl
],
onSubmit: function(e) {
var data = e.data, href = data.href;
// Delay confirm since onSubmit will move focus
function delayedConfirm(message, callback) {
var rng = editor.selection.getRng();
window.setTimeout(function() {
editor.windowManager.confirm(message, function(state) {
editor.selection.setRng(rng);
callback(state);
});
}, 0);
}
function insertLink() {
if (data.text != initialText) {
if (anchorElm) {
editor.focus();
anchorElm.innerHTML = data.text;
dom.setAttribs(anchorElm, {
href: href,
target: data.target ? data.target : null,
rel: data.rel ? data.rel : null
});
selection.select(anchorElm);
} else {
editor.insertContent(dom.createHTML('a', {
href: href,
target: data.target ? data.target : null,
rel: data.rel ? data.rel : null
}, data.text));
}
} else {
editor.execCommand('mceInsertLink', false, {
href: href,
target: data.target,
rel: data.rel ? data.rel : null
});
}
}
if (!href) {
editor.execCommand('unlink');
return;
}
// Is email and not //user@domain.com
if (href.indexOf('@') > 0 && href.indexOf('//') == -1 && href.indexOf('mailto:') == -1) {
delayedConfirm(
'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?',
function(state) {
if (state) {
href = 'mailto:' + href;
}
insertLink();
}
);
return;
}
// Is www. prefixed
if (/^\s*www\./i.test(href)) {
delayedConfirm(
'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?',
function(state) {
if (state) {
href = 'http://' + href;
}
insertLink();
}
);
return;
}
insertLink();
}
});
}
editor.addButton('link', {
icon: 'link',
tooltip: 'Insert/edit link',
shortcut: 'Ctrl+K',
onclick: createLinkList(showDialog),
stateSelector: 'a[href]'
});
editor.addButton('unlink', {
icon: 'unlink',
tooltip: 'Remove link',
cmd: 'unlink',
stateSelector: 'a[href]'
});
editor.addShortcut('Ctrl+K', '', createLinkList(showDialog));
this.showDialog = showDialog;
editor.addMenuItem('link', {
icon: 'link',
text: 'Insert link',
shortcut: 'Ctrl+K',
onclick: createLinkList(showDialog),
stateSelector: 'a[href]',
context: 'insert',
prependToContext: true
});
});

View File

@ -0,0 +1 @@
tinymce.PluginManager.add("link",function(e){function t(t){return function(){var n=e.settings.link_list;"string"==typeof n?tinymce.util.XHR.send({url:n,success:function(e){t(tinymce.util.JSON.parse(e))}}):t(n)}}function n(t){function n(e){var t=f.find("#text");(!t.value()||e.lastControl&&t.value()==e.lastControl.text())&&t.value(e.control.text()),f.find("#href").value(e.control.value())}function l(){var n=[{text:"None",value:""}];return tinymce.each(t,function(t){n.push({text:t.text||t.title,value:e.convertURL(t.value||t.url,"href"),menu:t.menu})}),n}function i(t){var n=[{text:"None",value:""}];return tinymce.each(e.settings.rel_list,function(e){n.push({text:e.text||e.title,value:e.value,selected:t===e.value})}),n}function r(t){var n=[{text:"None",value:""}];return e.settings.target_list||n.push({text:"New window",value:"_blank"}),tinymce.each(e.settings.target_list,function(e){n.push({text:e.text||e.title,value:e.value,selected:t===e.value})}),n}function a(t){var l=[];return tinymce.each(e.dom.select("a:not([href])"),function(e){var n=e.name||e.id;n&&l.push({text:n,value:"#"+n,selected:-1!=t.indexOf("#"+n)})}),l.length?(l.unshift({text:"None",value:""}),{name:"anchor",type:"listbox",label:"Anchors",values:l,onselect:n}):void 0}function o(){d&&d.value(e.convertURL(this.value(),"href")),c||0!==x.text.length||this.parent().parent().find("#text")[0].value(this.value())}var u,s,c,f,d,h,v,x={},g=e.selection,m=e.dom;u=g.getNode(),s=m.getParent(u,"a[href]"),x.text=c=s?s.innerText||s.textContent:g.getContent({format:"text"}),x.href=s?m.getAttrib(s,"href"):"",x.target=s?m.getAttrib(s,"target"):"",x.rel=s?m.getAttrib(s,"rel"):"","IMG"==u.nodeName&&(x.text=c=" "),t&&(d={type:"listbox",label:"Link list",values:l(),onselect:n,value:e.convertURL(x.href,"href"),onPostRender:function(){d=this}}),e.settings.target_list!==!1&&(v={name:"target",type:"listbox",label:"Target",values:r(x.target)}),e.settings.rel_list&&(h={name:"rel",type:"listbox",label:"Rel",values:i(x.rel)}),f=e.windowManager.open({title:"Insert link",data:x,body:[{name:"href",type:"filepicker",filetype:"file",size:40,autofocus:!0,label:"Url",onchange:o,onkeyup:o},{name:"text",type:"textbox",size:40,label:"Text to display",onchange:function(){x.text=this.value()}},a(x.href),d,h,v],onSubmit:function(t){function n(t,n){var l=e.selection.getRng();window.setTimeout(function(){e.windowManager.confirm(t,function(t){e.selection.setRng(l),n(t)})},0)}function l(){i.text!=c?s?(e.focus(),s.innerHTML=i.text,m.setAttribs(s,{href:r,target:i.target?i.target:null,rel:i.rel?i.rel:null}),g.select(s)):e.insertContent(m.createHTML("a",{href:r,target:i.target?i.target:null,rel:i.rel?i.rel:null},i.text)):e.execCommand("mceInsertLink",!1,{href:r,target:i.target,rel:i.rel?i.rel:null})}var i=t.data,r=i.href;return r?r.indexOf("@")>0&&-1==r.indexOf("//")&&-1==r.indexOf("mailto:")?(n("The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",function(e){e&&(r="mailto:"+r),l()}),void 0):/^\s*www\./i.test(r)?(n("The URL you entered seems to be an external link. Do you want to add the required http:// prefix?",function(e){e&&(r="http://"+r),l()}),void 0):(l(),void 0):(e.execCommand("unlink"),void 0)}})}e.addButton("link",{icon:"link",tooltip:"Insert/edit link",shortcut:"Ctrl+K",onclick:t(n),stateSelector:"a[href]"}),e.addButton("unlink",{icon:"unlink",tooltip:"Remove link",cmd:"unlink",stateSelector:"a[href]"}),e.addShortcut("Ctrl+K","",t(n)),this.showDialog=n,e.addMenuItem("link",{icon:"link",text:"Insert link",shortcut:"Ctrl+K",onclick:t(n),stateSelector:"a[href]",context:"insert",prependToContext:!0})});

View File

@ -1,17 +0,0 @@
#id, #name, #hspace, #vspace, #class_name, #align { width: 100px }
#hspace, #vspace { width: 50px }
#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode { width: 100px }
#flash_base, #flash_flashvars, #html5_altsource1, #html5_altsource2, #html5_poster { width: 240px }
#width, #height { width: 40px }
#src, #media_type { width: 250px }
#class { width: 120px }
#prev { margin: 0; border: 1px solid black; width: 380px; height: 260px; overflow: auto }
.panel_wrapper div.current { height: 420px; overflow: auto }
#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options { display: none }
.mceAddSelectValue { background-color: #DDDDDD }
#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume { width: 70px }
#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume { width: 70px }
#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks { width: 70px }
#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle { width: 90px }
#qt_qtsrc { width: 200px }
iframe {border: 1px solid gray}

File diff suppressed because one or more lines are too long

View File

@ -1,897 +0,0 @@
/**
* editor_plugin_src.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
var rootAttributes = tinymce.explode('id,name,width,height,style,align,class,hspace,vspace,bgcolor,type'), excludedAttrs = tinymce.makeMap(rootAttributes.join(',')), Node = tinymce.html.Node,
mediaTypes, scriptRegExp, JSON = tinymce.util.JSON, mimeTypes;
// Media types supported by this plugin
mediaTypes = [
// Type, clsid:s, mime types, codebase
["Flash", "d27cdb6e-ae6d-11cf-96b8-444553540000", "application/x-shockwave-flash", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],
["ShockWave", "166b1bca-3f9c-11cf-8075-444553540000", "application/x-director", "http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0"],
["WindowsMedia", "6bf52a52-394a-11d3-b153-00c04f79faa6,22d6f312-b0f6-11d0-94ab-0080c74c7e95,05589fa1-c356-11ce-bf01-00aa0055595a", "application/x-mplayer2", "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"],
["QuickTime", "02bf25d5-8c17-4b23-bc80-d3488abddc6b", "video/quicktime", "http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"],
["RealMedia", "cfcdaa03-8be4-11cf-b84b-0020afbbccfa", "audio/x-pn-realaudio-plugin", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],
["Java", "8ad9c840-044e-11d1-b3e9-00805f499d93", "application/x-java-applet", "http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"],
["Silverlight", "dfeaf541-f3e1-4c24-acac-99c30715084a", "application/x-silverlight-2"],
["Iframe"],
["Video"],
["EmbeddedAudio"],
["Audio"]
];
function normalizeSize(size) {
return typeof(size) == "string" ? size.replace(/[^0-9%]/g, '') : size;
}
function toArray(obj) {
var undef, out, i;
if (obj && !obj.splice) {
out = [];
for (i = 0; true; i++) {
if (obj[i])
out[i] = obj[i];
else
break;
}
return out;
}
return obj;
};
tinymce.create('tinymce.plugins.MediaPlugin', {
init : function(ed, url) {
var self = this, lookup = {}, i, y, item, name;
function isMediaImg(node) {
return node && node.nodeName === 'IMG' && ed.dom.hasClass(node, 'mceItemMedia');
};
self.editor = ed;
self.url = url;
// Parse media types into a lookup table
scriptRegExp = '';
for (i = 0; i < mediaTypes.length; i++) {
name = mediaTypes[i][0];
item = {
name : name,
clsids : tinymce.explode(mediaTypes[i][1] || ''),
mimes : tinymce.explode(mediaTypes[i][2] || ''),
codebase : mediaTypes[i][3]
};
for (y = 0; y < item.clsids.length; y++)
lookup['clsid:' + item.clsids[y]] = item;
for (y = 0; y < item.mimes.length; y++)
lookup[item.mimes[y]] = item;
lookup['mceItem' + name] = item;
lookup[name.toLowerCase()] = item;
scriptRegExp += (scriptRegExp ? '|' : '') + name;
}
// Handle the media_types setting
tinymce.each(ed.getParam("media_types",
"video=mp4,m4v,ogv,webm;" +
"silverlight=xap;" +
"flash=swf,flv;" +
"shockwave=dcr;" +
"quicktime=mov,qt,mpg,mpeg;" +
"shockwave=dcr;" +
"windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;" +
"realmedia=rm,ra,ram;" +
"java=jar;" +
"audio=mp3,ogg"
).split(';'), function(item) {
var i, extensions, type;
item = item.split(/=/);
extensions = tinymce.explode(item[1].toLowerCase());
for (i = 0; i < extensions.length; i++) {
type = lookup[item[0].toLowerCase()];
if (type)
lookup[extensions[i]] = type;
}
});
scriptRegExp = new RegExp('write(' + scriptRegExp + ')\\(([^)]+)\\)');
self.lookup = lookup;
ed.onPreInit.add(function() {
// Allow video elements
ed.schema.addValidElements('object[id|style|width|height|classid|codebase|*],param[name|value],embed[id|style|width|height|type|src|*],video[*],audio[*],source[*]');
// Convert video elements to image placeholder
ed.parser.addNodeFilter('object,embed,video,audio,script,iframe', function(nodes) {
var i = nodes.length;
while (i--)
self.objectToImg(nodes[i]);
});
// Convert image placeholders to video elements
ed.serializer.addNodeFilter('img', function(nodes, name, args) {
var i = nodes.length, node;
while (i--) {
node = nodes[i];
if ((node.attr('class') || '').indexOf('mceItemMedia') !== -1)
self.imgToObject(node, args);
}
});
});
ed.onInit.add(function() {
// Display "media" instead of "img" in element path
if (ed.theme && ed.theme.onResolveName) {
ed.theme.onResolveName.add(function(theme, path_object) {
if (path_object.name === 'img' && ed.dom.hasClass(path_object.node, 'mceItemMedia'))
path_object.name = 'media';
});
}
// Add contect menu if it's loaded
if (ed && ed.plugins.contextmenu) {
ed.plugins.contextmenu.onContextMenu.add(function(plugin, menu, element) {
if (element.nodeName === 'IMG' && element.className.indexOf('mceItemMedia') !== -1)
menu.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'});
});
}
});
// Register commands
ed.addCommand('mceMedia', function() {
var data, img;
img = ed.selection.getNode();
if (isMediaImg(img)) {
data = ed.dom.getAttrib(img, 'data-mce-json');
if (data) {
data = JSON.parse(data);
// Add some extra properties to the data object
tinymce.each(rootAttributes, function(name) {
var value = ed.dom.getAttrib(img, name);
if (value)
data[name] = value;
});
data.type = self.getType(img.className).name.toLowerCase();
}
}
if (!data) {
data = {
type : 'flash',
video: {sources:[]},
params: {}
};
}
ed.windowManager.open({
file : url + '/media.htm',
width : 430 + parseInt(ed.getLang('media.delta_width', 0)),
height : 500 + parseInt(ed.getLang('media.delta_height', 0)),
inline : 1
}, {
plugin_url : url,
data : data
});
});
// Register buttons
ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'});
// Update media selection status
ed.onNodeChange.add(function(ed, cm, node) {
cm.setActive('media', isMediaImg(node));
});
},
convertUrl : function(url, force_absolute) {
var self = this, editor = self.editor, settings = editor.settings,
urlConverter = settings.url_converter,
urlConverterScope = settings.url_converter_scope || self;
if (!url)
return url;
if (force_absolute)
return editor.documentBaseURI.toAbsolute(url);
return urlConverter.call(urlConverterScope, url, 'src', 'object');
},
getInfo : function() {
return {
longname : 'Media',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',
version : tinymce.majorVersion + "." + tinymce.minorVersion
};
},
/**
* Converts the JSON data object to an img node.
*/
dataToImg : function(data, force_absolute) {
var self = this, editor = self.editor, baseUri = editor.documentBaseURI, sources, attrs, img, i;
data.params.src = self.convertUrl(data.params.src, force_absolute);
attrs = data.video.attrs;
if (attrs)
attrs.src = self.convertUrl(attrs.src, force_absolute);
if (attrs)
attrs.poster = self.convertUrl(attrs.poster, force_absolute);
sources = toArray(data.video.sources);
if (sources) {
for (i = 0; i < sources.length; i++)
sources[i].src = self.convertUrl(sources[i].src, force_absolute);
}
img = self.editor.dom.create('img', {
id : data.id,
style : data.style,
align : data.align,
hspace : data.hspace,
vspace : data.vspace,
src : self.editor.theme.url + '/img/trans.gif',
'class' : 'mceItemMedia mceItem' + self.getType(data.type).name,
'data-mce-json' : JSON.serialize(data, "'")
});
img.width = data.width = normalizeSize(data.width || (data.type == 'audio' ? "300" : "320"));
img.height = data.height = normalizeSize(data.height || (data.type == 'audio' ? "32" : "240"));
return img;
},
/**
* Converts the JSON data object to a HTML string.
*/
dataToHtml : function(data, force_absolute) {
return this.editor.serializer.serialize(this.dataToImg(data, force_absolute), {forced_root_block : '', force_absolute : force_absolute});
},
/**
* Converts the JSON data object to a HTML string.
*/
htmlToData : function(html) {
var fragment, img, data;
data = {
type : 'flash',
video: {sources:[]},
params: {}
};
fragment = this.editor.parser.parse(html);
img = fragment.getAll('img')[0];
if (img) {
data = JSON.parse(img.attr('data-mce-json'));
data.type = this.getType(img.attr('class')).name.toLowerCase();
// Add some extra properties to the data object
tinymce.each(rootAttributes, function(name) {
var value = img.attr(name);
if (value)
data[name] = value;
});
}
return data;
},
/**
* Get type item by extension, class, clsid or mime type.
*
* @method getType
* @param {String} value Value to get type item by.
* @return {Object} Type item object or undefined.
*/
getType : function(value) {
var i, values, typeItem;
// Find type by checking the classes
values = tinymce.explode(value, ' ');
for (i = 0; i < values.length; i++) {
typeItem = this.lookup[values[i]];
if (typeItem)
return typeItem;
}
},
/**
* Converts a tinymce.html.Node image element to video/object/embed.
*/
imgToObject : function(node, args) {
var self = this, editor = self.editor, video, object, embed, iframe, name, value, data,
source, sources, params, param, typeItem, i, item, mp4Source, replacement,
posterSrc, style, audio;
// Adds the flash player
function addPlayer(video_src, poster_src) {
var baseUri, flashVars, flashVarsOutput, params, flashPlayer;
flashPlayer = editor.getParam('flash_video_player_url', self.convertUrl(self.url + '/moxieplayer.swf'));
if (flashPlayer) {
baseUri = editor.documentBaseURI;
data.params.src = flashPlayer;
// Convert the movie url to absolute urls
if (editor.getParam('flash_video_player_absvideourl', true)) {
video_src = baseUri.toAbsolute(video_src || '', true);
poster_src = baseUri.toAbsolute(poster_src || '', true);
}
// Generate flash vars
flashVarsOutput = '';
flashVars = editor.getParam('flash_video_player_flashvars', {url : '$url', poster : '$poster'});
tinymce.each(flashVars, function(value, name) {
// Replace $url and $poster variables in flashvars value
value = value.replace(/\$url/, video_src || '');
value = value.replace(/\$poster/, poster_src || '');
if (value.length > 0)
flashVarsOutput += (flashVarsOutput ? '&' : '') + name + '=' + escape(value);
});
if (flashVarsOutput.length)
data.params.flashvars = flashVarsOutput;
params = editor.getParam('flash_video_player_params', {
allowfullscreen: true,
allowscriptaccess: true
});
tinymce.each(params, function(value, name) {
data.params[name] = "" + value;
});
}
};
data = node.attr('data-mce-json');
if (!data)
return;
data = JSON.parse(data);
typeItem = this.getType(node.attr('class'));
style = node.attr('data-mce-style');
if (!style) {
style = node.attr('style');
if (style)
style = editor.dom.serializeStyle(editor.dom.parseStyle(style, 'img'));
}
// Use node width/height to override the data width/height when the placeholder is resized
data.width = node.attr('width') || data.width;
data.height = node.attr('height') || data.height;
// Handle iframe
if (typeItem.name === 'Iframe') {
replacement = new Node('iframe', 1);
tinymce.each(rootAttributes, function(name) {
var value = node.attr(name);
if (name == 'class' && value)
value = value.replace(/mceItem.+ ?/g, '');
if (value && value.length > 0)
replacement.attr(name, value);
});
for (name in data.params)
replacement.attr(name, data.params[name]);
replacement.attr({
style: style,
src: data.params.src
});
node.replace(replacement);
return;
}
// Handle scripts
if (this.editor.settings.media_use_script) {
replacement = new Node('script', 1).attr('type', 'text/javascript');
value = new Node('#text', 3);
value.value = 'write' + typeItem.name + '(' + JSON.serialize(tinymce.extend(data.params, {
width: node.attr('width'),
height: node.attr('height')
})) + ');';
replacement.append(value);
node.replace(replacement);
return;
}
// Add HTML5 video element
if (typeItem.name === 'Video' && data.video.sources && data.video.sources[0]) {
// Create new object element
video = new Node('video', 1).attr(tinymce.extend({
id : node.attr('id'),
width: normalizeSize(node.attr('width')),
height: normalizeSize(node.attr('height')),
style : style
}, data.video.attrs));
// Get poster source and use that for flash fallback
if (data.video.attrs)
posterSrc = data.video.attrs.poster;
sources = data.video.sources = toArray(data.video.sources);
for (i = 0; i < sources.length; i++) {
if (/\.mp4$/.test(sources[i].src))
mp4Source = sources[i].src;
}
if (!sources[0].type) {
video.attr('src', sources[0].src);
sources.splice(0, 1);
}
for (i = 0; i < sources.length; i++) {
source = new Node('source', 1).attr(sources[i]);
source.shortEnded = true;
video.append(source);
}
// Create flash fallback for video if we have a mp4 source
if (mp4Source) {
addPlayer(mp4Source, posterSrc);
typeItem = self.getType('flash');
} else
data.params.src = '';
}
// Add HTML5 audio element
if (typeItem.name === 'Audio' && data.video.sources && data.video.sources[0]) {
// Create new object element
audio = new Node('audio', 1).attr(tinymce.extend({
id : node.attr('id'),
width: normalizeSize(node.attr('width')),
height: normalizeSize(node.attr('height')),
style : style
}, data.video.attrs));
// Get poster source and use that for flash fallback
if (data.video.attrs)
posterSrc = data.video.attrs.poster;
sources = data.video.sources = toArray(data.video.sources);
if (!sources[0].type) {
audio.attr('src', sources[0].src);
sources.splice(0, 1);
}
for (i = 0; i < sources.length; i++) {
source = new Node('source', 1).attr(sources[i]);
source.shortEnded = true;
audio.append(source);
}
data.params.src = '';
}
if (typeItem.name === 'EmbeddedAudio') {
embed = new Node('embed', 1);
embed.shortEnded = true;
embed.attr({
id: node.attr('id'),
width: normalizeSize(node.attr('width')),
height: normalizeSize(node.attr('height')),
style : style,
type: node.attr('type')
});
for (name in data.params)
embed.attr(name, data.params[name]);
tinymce.each(rootAttributes, function(name) {
if (data[name] && name != 'type')
embed.attr(name, data[name]);
});
data.params.src = '';
}
// Do we have a params src then we can generate object
if (data.params.src) {
// Is flv movie add player for it
if (/\.flv$/i.test(data.params.src))
addPlayer(data.params.src, '');
if (args && args.force_absolute)
data.params.src = editor.documentBaseURI.toAbsolute(data.params.src);
// Create new object element
object = new Node('object', 1).attr({
id : node.attr('id'),
width: normalizeSize(node.attr('width')),
height: normalizeSize(node.attr('height')),
style : style
});
tinymce.each(rootAttributes, function(name) {
var value = data[name];
if (name == 'class' && value)
value = value.replace(/mceItem.+ ?/g, '');
if (value && name != 'type')
object.attr(name, value);
});
// Add params
for (name in data.params) {
param = new Node('param', 1);
param.shortEnded = true;
value = data.params[name];
// Windows media needs to use url instead of src for the media URL
if (name === 'src' && typeItem.name === 'WindowsMedia')
name = 'url';
param.attr({name: name, value: value});
object.append(param);
}
// Setup add type and classid if strict is disabled
if (this.editor.getParam('media_strict', true)) {
object.attr({
data: data.params.src,
type: typeItem.mimes[0]
});
} else {
if ( typeItem.clsids )
object.attr('clsid', typeItem.clsids[0]);
object.attr('codebase', typeItem.codebase);
embed = new Node('embed', 1);
embed.shortEnded = true;
embed.attr({
id: node.attr('id'),
width: normalizeSize(node.attr('width')),
height: normalizeSize(node.attr('height')),
style : style,
type: typeItem.mimes[0]
});
for (name in data.params)
embed.attr(name, data.params[name]);
tinymce.each(rootAttributes, function(name) {
if (data[name] && name != 'type')
embed.attr(name, data[name]);
});
object.append(embed);
}
// Insert raw HTML
if (data.object_html) {
value = new Node('#text', 3);
value.raw = true;
value.value = data.object_html;
object.append(value);
}
// Append object to video element if it exists
if (video)
video.append(object);
}
if (video) {
// Insert raw HTML
if (data.video_html) {
value = new Node('#text', 3);
value.raw = true;
value.value = data.video_html;
video.append(value);
}
}
if (audio) {
// Insert raw HTML
if (data.video_html) {
value = new Node('#text', 3);
value.raw = true;
value.value = data.video_html;
audio.append(value);
}
}
var n = video || audio || object || embed;
if (n)
node.replace(n);
else
node.remove();
},
/**
* Converts a tinymce.html.Node video/object/embed to an img element.
*
* The video/object/embed will be converted into an image placeholder with a JSON data attribute like this:
* <img class="mceItemMedia mceItemFlash" width="100" height="100" data-mce-json="{..}" />
*
* The JSON structure will be like this:
* {'params':{'flashvars':'something','quality':'high','src':'someurl'}, 'video':{'sources':[{src: 'someurl', type: 'video/mp4'}]}}
*/
objectToImg : function(node) {
var object, embed, video, iframe, img, name, id, width, height, style, i, html,
param, params, source, sources, data, type, lookup = this.lookup,
matches, attrs, urlConverter = this.editor.settings.url_converter,
urlConverterScope = this.editor.settings.url_converter_scope,
hspace, vspace, align, bgcolor;
function getInnerHTML(node) {
return new tinymce.html.Serializer({
inner: true,
validate: false
}).serialize(node);
};
function lookupAttribute(o, attr) {
return lookup[(o.attr(attr) || '').toLowerCase()];
}
function lookupExtension(src) {
var ext = src.replace(/^.*\.([^.]+)$/, '$1');
return lookup[ext.toLowerCase() || ''];
}
// If node isn't in document
if (!node.parent)
return;
// Handle media scripts
if (node.name === 'script') {
if (node.firstChild)
matches = scriptRegExp.exec(node.firstChild.value);
if (!matches)
return;
type = matches[1];
data = {video : {}, params : JSON.parse(matches[2])};
width = data.params.width;
height = data.params.height;
}
// Setup data objects
data = data || {
video : {},
params : {}
};
// Setup new image object
img = new Node('img', 1);
img.attr({
src : this.editor.theme.url + '/img/trans.gif'
});
// Video element
name = node.name;
if (name === 'video' || name == 'audio') {
video = node;
object = node.getAll('object')[0];
embed = node.getAll('embed')[0];
width = video.attr('width');
height = video.attr('height');
id = video.attr('id');
data.video = {attrs : {}, sources : []};
// Get all video attributes
attrs = data.video.attrs;
for (name in video.attributes.map)
attrs[name] = video.attributes.map[name];
source = node.attr('src');
if (source)
data.video.sources.push({src : urlConverter.call(urlConverterScope, source, 'src', node.name)});
// Get all sources
sources = video.getAll("source");
for (i = 0; i < sources.length; i++) {
source = sources[i].remove();
data.video.sources.push({
src: urlConverter.call(urlConverterScope, source.attr('src'), 'src', 'source'),
type: source.attr('type'),
media: source.attr('media')
});
}
// Convert the poster URL
if (attrs.poster)
attrs.poster = urlConverter.call(urlConverterScope, attrs.poster, 'poster', node.name);
}
// Object element
if (node.name === 'object') {
object = node;
embed = node.getAll('embed')[0];
}
// Embed element
if (node.name === 'embed')
embed = node;
// Iframe element
if (node.name === 'iframe') {
iframe = node;
type = 'Iframe';
}
if (object) {
// Get width/height
width = width || object.attr('width');
height = height || object.attr('height');
style = style || object.attr('style');
id = id || object.attr('id');
hspace = hspace || object.attr('hspace');
vspace = vspace || object.attr('vspace');
align = align || object.attr('align');
bgcolor = bgcolor || object.attr('bgcolor');
data.name = object.attr('name');
// Get all object params
params = object.getAll("param");
for (i = 0; i < params.length; i++) {
param = params[i];
name = param.remove().attr('name');
if (!excludedAttrs[name])
data.params[name] = param.attr('value');
}
data.params.src = data.params.src || object.attr('data');
}
if (embed) {
// Get width/height
width = width || embed.attr('width');
height = height || embed.attr('height');
style = style || embed.attr('style');
id = id || embed.attr('id');
hspace = hspace || embed.attr('hspace');
vspace = vspace || embed.attr('vspace');
align = align || embed.attr('align');
bgcolor = bgcolor || embed.attr('bgcolor');
// Get all embed attributes
for (name in embed.attributes.map) {
if (!excludedAttrs[name] && !data.params[name])
data.params[name] = embed.attributes.map[name];
}
}
if (iframe) {
// Get width/height
width = normalizeSize(iframe.attr('width'));
height = normalizeSize(iframe.attr('height'));
style = style || iframe.attr('style');
id = iframe.attr('id');
hspace = iframe.attr('hspace');
vspace = iframe.attr('vspace');
align = iframe.attr('align');
bgcolor = iframe.attr('bgcolor');
tinymce.each(rootAttributes, function(name) {
img.attr(name, iframe.attr(name));
});
// Get all iframe attributes
for (name in iframe.attributes.map) {
if (!excludedAttrs[name] && !data.params[name])
data.params[name] = iframe.attributes.map[name];
}
}
// Use src not movie
if (data.params.movie) {
data.params.src = data.params.src || data.params.movie;
delete data.params.movie;
}
// Convert the URL to relative/absolute depending on configuration
if (data.params.src)
data.params.src = urlConverter.call(urlConverterScope, data.params.src, 'src', 'object');
if (video) {
if (node.name === 'video')
type = lookup.video.name;
else if (node.name === 'audio')
type = lookup.audio.name;
}
if (object && !type)
type = (lookupAttribute(object, 'clsid') || lookupAttribute(object, 'classid') || lookupAttribute(object, 'type') || {}).name;
if (embed && !type)
type = (lookupAttribute(embed, 'type') || lookupExtension(data.params.src) || {}).name;
// for embedded audio we preserve the original specified type
if (embed && type == 'EmbeddedAudio') {
data.params.type = embed.attr('type');
}
// Replace the video/object/embed element with a placeholder image containing the data
node.replace(img);
// Remove embed
if (embed)
embed.remove();
// Serialize the inner HTML of the object element
if (object) {
html = getInnerHTML(object.remove());
if (html)
data.object_html = html;
}
// Serialize the inner HTML of the video element
if (video) {
html = getInnerHTML(video.remove());
if (html)
data.video_html = html;
}
data.hspace = hspace;
data.vspace = vspace;
data.align = align;
data.bgcolor = bgcolor;
// Set width/height of placeholder
img.attr({
id : id,
'class' : 'mceItemMedia mceItem' + (type || 'Flash'),
style : style,
width : width || (node.name == 'audio' ? "300" : "320"),
height : height || (node.name == 'audio' ? "32" : "240"),
hspace : hspace,
vspace : vspace,
align : align,
bgcolor : bgcolor,
"data-mce-json" : JSON.serialize(data, "'")
});
}
});
// Register plugin
tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin);
})();

View File

@ -1,73 +0,0 @@
/**
* This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
*/
function writeFlash(p) {
writeEmbed(
'D27CDB6E-AE6D-11cf-96B8-444553540000',
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
'application/x-shockwave-flash',
p
);
}
function writeShockWave(p) {
writeEmbed(
'166B1BCA-3F9C-11CF-8075-444553540000',
'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
'application/x-director',
p
);
}
function writeQuickTime(p) {
writeEmbed(
'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
'video/quicktime',
p
);
}
function writeRealMedia(p) {
writeEmbed(
'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
'audio/x-pn-realaudio-plugin',
p
);
}
function writeWindowsMedia(p) {
p.url = p.src;
writeEmbed(
'6BF52A52-394A-11D3-B153-00C04F79FAA6',
'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
'application/x-mplayer2',
p
);
}
function writeEmbed(cls, cb, mt, p) {
var h = '', n;
h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
h += '>';
for (n in p)
h += '<param name="' + n + '" value="' + p[n] + '">';
h += '<embed type="' + mt + '"';
for (n in p)
h += n + '="' + p[n] + '" ';
h += '></embed></object>';
document.write(h);
}

View File

@ -1,513 +0,0 @@
(function() {
var url;
if (url = tinyMCEPopup.getParam("media_external_list_url"))
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
function get(id) {
return document.getElementById(id);
}
function clone(obj) {
var i, len, copy, attr;
if (null == obj || "object" != typeof obj)
return obj;
// Handle Array
if ('length' in obj) {
copy = [];
for (i = 0, len = obj.length; i < len; ++i) {
copy[i] = clone(obj[i]);
}
return copy;
}
// Handle Object
copy = {};
for (attr in obj) {
if (obj.hasOwnProperty(attr))
copy[attr] = clone(obj[attr]);
}
return copy;
}
function getVal(id) {
var elm = get(id);
if (elm.nodeName == "SELECT")
return elm.options[elm.selectedIndex].value;
if (elm.type == "checkbox")
return elm.checked;
return elm.value;
}
function setVal(id, value, name) {
if (typeof(value) != 'undefined' && value != null) {
var elm = get(id);
if (elm.nodeName == "SELECT")
selectByValue(document.forms[0], id, value);
else if (elm.type == "checkbox") {
if (typeof(value) == 'string') {
value = value.toLowerCase();
value = (!name && value === 'true') || (name && value === name.toLowerCase());
}
elm.checked = !!value;
} else
elm.value = value;
}
}
window.Media = {
init : function() {
var html, editor, self = this;
self.editor = editor = tinyMCEPopup.editor;
// Setup file browsers and color pickers
get('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');
get('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','quicktime_qtsrc','media','media');
get('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
get('video_altsource1_filebrowser').innerHTML = getBrowserHTML('video_filebrowser_altsource1','video_altsource1','media','media');
get('video_altsource2_filebrowser').innerHTML = getBrowserHTML('video_filebrowser_altsource2','video_altsource2','media','media');
get('audio_altsource1_filebrowser').innerHTML = getBrowserHTML('audio_filebrowser_altsource1','audio_altsource1','media','media');
get('audio_altsource2_filebrowser').innerHTML = getBrowserHTML('audio_filebrowser_altsource2','audio_altsource2','media','media');
get('video_poster_filebrowser').innerHTML = getBrowserHTML('filebrowser_poster','video_poster','image','media');
html = self.getMediaListHTML('medialist', 'src', 'media', 'media');
if (html == "")
get("linklistrow").style.display = 'none';
else
get("linklistcontainer").innerHTML = html;
if (isVisible('filebrowser'))
get('src').style.width = '230px';
if (isVisible('video_filebrowser_altsource1'))
get('video_altsource1').style.width = '220px';
if (isVisible('video_filebrowser_altsource2'))
get('video_altsource2').style.width = '220px';
if (isVisible('audio_filebrowser_altsource1'))
get('audio_altsource1').style.width = '220px';
if (isVisible('audio_filebrowser_altsource2'))
get('audio_altsource2').style.width = '220px';
if (isVisible('filebrowser_poster'))
get('video_poster').style.width = '220px';
editor.dom.setOuterHTML(get('media_type'), self.getMediaTypeHTML(editor));
self.setDefaultDialogSettings(editor);
self.data = clone(tinyMCEPopup.getWindowArg('data'));
self.dataToForm();
self.preview();
updateColor('bgcolor_pick', 'bgcolor');
},
insert : function() {
var editor = tinyMCEPopup.editor;
this.formToData();
editor.execCommand('mceRepaint');
tinyMCEPopup.restoreSelection();
editor.selection.setNode(editor.plugins.media.dataToImg(this.data));
tinyMCEPopup.close();
},
preview : function() {
get('prev').innerHTML = this.editor.plugins.media.dataToHtml(this.data, true);
},
moveStates : function(to_form, field) {
var data = this.data, editor = this.editor,
mediaPlugin = editor.plugins.media, ext, src, typeInfo, defaultStates, src;
defaultStates = {
// QuickTime
quicktime_autoplay : true,
quicktime_controller : true,
// Flash
flash_play : true,
flash_loop : true,
flash_menu : true,
// WindowsMedia
windowsmedia_autostart : true,
windowsmedia_enablecontextmenu : true,
windowsmedia_invokeurls : true,
// RealMedia
realmedia_autogotourl : true,
realmedia_imagestatus : true
};
function parseQueryParams(str) {
var out = {};
if (str) {
tinymce.each(str.split('&'), function(item) {
var parts = item.split('=');
out[unescape(parts[0])] = unescape(parts[1]);
});
}
return out;
};
function setOptions(type, names) {
var i, name, formItemName, value, list;
if (type == data.type || type == 'global') {
names = tinymce.explode(names);
for (i = 0; i < names.length; i++) {
name = names[i];
formItemName = type == 'global' ? name : type + '_' + name;
if (type == 'global')
list = data;
else if (type == 'video' || type == 'audio') {
list = data.video.attrs;
if (!list && !to_form)
data.video.attrs = list = {};
} else
list = data.params;
if (list) {
if (to_form) {
setVal(formItemName, list[name], type == 'video' || type == 'audio' ? name : '');
} else {
delete list[name];
value = getVal(formItemName);
if ((type == 'video' || type == 'audio') && value === true)
value = name;
if (defaultStates[formItemName]) {
if (value !== defaultStates[formItemName]) {
value = "" + value;
list[name] = value;
}
} else if (value) {
value = "" + value;
list[name] = value;
}
}
}
}
}
}
if (!to_form) {
data.type = get('media_type').options[get('media_type').selectedIndex].value;
data.width = getVal('width');
data.height = getVal('height');
// Switch type based on extension
src = getVal('src');
if (field == 'src') {
ext = src.replace(/^.*\.([^.]+)$/, '$1');
if (typeInfo = mediaPlugin.getType(ext))
data.type = typeInfo.name.toLowerCase();
setVal('media_type', data.type);
}
if (data.type == "video" || data.type == "audio") {
if (!data.video.sources)
data.video.sources = [];
data.video.sources[0] = {src: getVal('src')};
}
}
// Hide all fieldsets and show the one active
get('video_options').style.display = 'none';
get('audio_options').style.display = 'none';
get('flash_options').style.display = 'none';
get('quicktime_options').style.display = 'none';
get('shockwave_options').style.display = 'none';
get('windowsmedia_options').style.display = 'none';
get('realmedia_options').style.display = 'none';
get('embeddedaudio_options').style.display = 'none';
if (get(data.type + '_options'))
get(data.type + '_options').style.display = 'block';
setVal('media_type', data.type);
setOptions('flash', 'play,loop,menu,swliveconnect,quality,scale,salign,wmode,base,flashvars');
setOptions('quicktime', 'loop,autoplay,cache,controller,correction,enablejavascript,kioskmode,autohref,playeveryframe,targetcache,scale,starttime,endtime,target,qtsrcchokespeed,volume,qtsrc');
setOptions('shockwave', 'sound,progress,autostart,swliveconnect,swvolume,swstretchstyle,swstretchhalign,swstretchvalign');
setOptions('windowsmedia', 'autostart,enabled,enablecontextmenu,fullscreen,invokeurls,mute,stretchtofit,windowlessvideo,balance,baseurl,captioningid,currentmarker,currentposition,defaultframe,playcount,rate,uimode,volume');
setOptions('realmedia', 'autostart,loop,autogotourl,center,imagestatus,maintainaspect,nojava,prefetch,shuffle,console,controls,numloop,scriptcallbacks');
setOptions('video', 'poster,autoplay,loop,muted,preload,controls');
setOptions('audio', 'autoplay,loop,preload,controls');
setOptions('embeddedaudio', 'autoplay,loop,controls');
setOptions('global', 'id,name,vspace,hspace,bgcolor,align,width,height');
if (to_form) {
if (data.type == 'video') {
if (data.video.sources[0])
setVal('src', data.video.sources[0].src);
src = data.video.sources[1];
if (src)
setVal('video_altsource1', src.src);
src = data.video.sources[2];
if (src)
setVal('video_altsource2', src.src);
} else if (data.type == 'audio') {
if (data.video.sources[0])
setVal('src', data.video.sources[0].src);
src = data.video.sources[1];
if (src)
setVal('audio_altsource1', src.src);
src = data.video.sources[2];
if (src)
setVal('audio_altsource2', src.src);
} else {
// Check flash vars
if (data.type == 'flash') {
tinymce.each(editor.getParam('flash_video_player_flashvars', {url : '$url', poster : '$poster'}), function(value, name) {
if (value == '$url')
data.params.src = parseQueryParams(data.params.flashvars)[name] || data.params.src || '';
});
}
setVal('src', data.params.src);
}
} else {
src = getVal("src");
// YouTube Embed
if (src.match(/youtube\.com\/embed\/\w+/)) {
data.width = 425;
data.height = 350;
data.params.frameborder = '0';
data.type = 'iframe';
setVal('src', src);
setVal('media_type', data.type);
} else {
// YouTube *NEW*
if (src.match(/youtu\.be\/[a-z1-9.-_]+/)) {
data.width = 425;
data.height = 350;
data.params.frameborder = '0';
data.type = 'iframe';
src = 'http://www.youtube.com/embed/' + src.match(/youtu.be\/([a-z1-9.-_]+)/)[1];
setVal('src', src);
setVal('media_type', data.type);
}
// YouTube
if (src.match(/youtube\.com(.+)v=([^&]+)/)) {
data.width = 425;
data.height = 350;
data.params.frameborder = '0';
data.type = 'iframe';
src = 'http://www.youtube.com/embed/' + src.match(/v=([^&]+)/)[1];
setVal('src', src);
setVal('media_type', data.type);
}
}
// Google video
if (src.match(/video\.google\.com(.+)docid=([^&]+)/)) {
data.width = 425;
data.height = 326;
data.type = 'flash';
src = 'http://video.google.com/googleplayer.swf?docId=' + src.match(/docid=([^&]+)/)[1] + '&hl=en';
setVal('src', src);
setVal('media_type', data.type);
}
// Vimeo
if (src.match(/vimeo\.com\/([0-9]+)/)) {
data.width = 425;
data.height = 350;
data.params.frameborder = '0';
data.type = 'iframe';
src = 'http://player.vimeo.com/video/' + src.match(/vimeo.com\/([0-9]+)/)[1];
setVal('src', src);
setVal('media_type', data.type);
}
// stream.cz
if (src.match(/stream\.cz\/((?!object).)*\/([0-9]+)/)) {
data.width = 425;
data.height = 350;
data.params.frameborder = '0';
data.type = 'iframe';
src = 'http://www.stream.cz/object/' + src.match(/stream.cz\/[^/]+\/([0-9]+)/)[1];
setVal('src', src);
setVal('media_type', data.type);
}
// Google maps
if (src.match(/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/)) {
data.width = 425;
data.height = 350;
data.params.frameborder = '0';
data.type = 'iframe';
src = 'http://maps.google.com/maps/ms?msid=' + src.match(/msid=(.+)/)[1] + "&output=embed";
setVal('src', src);
setVal('media_type', data.type);
}
if (data.type == 'video') {
if (!data.video.sources)
data.video.sources = [];
data.video.sources[0] = {src : src};
src = getVal("video_altsource1");
if (src)
data.video.sources[1] = {src : src};
src = getVal("video_altsource2");
if (src)
data.video.sources[2] = {src : src};
} else if (data.type == 'audio') {
if (!data.video.sources)
data.video.sources = [];
data.video.sources[0] = {src : src};
src = getVal("audio_altsource1");
if (src)
data.video.sources[1] = {src : src};
src = getVal("audio_altsource2");
if (src)
data.video.sources[2] = {src : src};
} else
data.params.src = src;
// Set default size
setVal('width', data.width || (data.type == 'audio' ? 300 : 320));
setVal('height', data.height || (data.type == 'audio' ? 32 : 240));
}
},
dataToForm : function() {
this.moveStates(true);
},
formToData : function(field) {
if (field == "width" || field == "height")
this.changeSize(field);
if (field == 'source') {
this.moveStates(false, field);
setVal('source', this.editor.plugins.media.dataToHtml(this.data));
this.panel = 'source';
} else {
if (this.panel == 'source') {
this.data = clone(this.editor.plugins.media.htmlToData(getVal('source')));
this.dataToForm();
this.panel = '';
}
this.moveStates(false, field);
this.preview();
}
},
beforeResize : function() {
this.width = parseInt(getVal('width') || (this.data.type == 'audio' ? "300" : "320"), 10);
this.height = parseInt(getVal('height') || (this.data.type == 'audio' ? "32" : "240"), 10);
},
changeSize : function(type) {
var width, height, scale, size;
if (get('constrain').checked) {
width = parseInt(getVal('width') || (this.data.type == 'audio' ? "300" : "320"), 10);
height = parseInt(getVal('height') || (this.data.type == 'audio' ? "32" : "240"), 10);
if (type == 'width') {
this.height = Math.round((width / this.width) * height);
setVal('height', this.height);
} else {
this.width = Math.round((height / this.height) * width);
setVal('width', this.width);
}
}
},
getMediaListHTML : function() {
if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) {
var html = "";
html += '<select id="linklist" name="linklist" style="width: 250px" onchange="this.form.src.value=this.options[this.selectedIndex].value;Media.formToData(\'src\');">';
html += '<option value="">---</option>';
for (var i=0; i<tinyMCEMediaList.length; i++)
html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>';
html += '</select>';
return html;
}
return "";
},
getMediaTypeHTML : function(editor) {
function option(media_type, element) {
if (!editor.schema.getElementRule(element || media_type)) {
return '';
}
return '<option value="'+media_type+'">'+tinyMCEPopup.editor.translate("media_dlg."+media_type)+'</option>'
}
var html = "";
html += '<select id="media_type" name="media_type" onchange="Media.formToData(\'type\');">';
html += option("video");
html += option("audio");
html += option("flash", "object");
html += option("quicktime", "object");
html += option("shockwave", "object");
html += option("windowsmedia", "object");
html += option("realmedia", "object");
html += option("iframe");
if (editor.getParam('media_embedded_audio', false)) {
html += option('embeddedaudio', "object");
}
html += '</select>';
return html;
},
setDefaultDialogSettings : function(editor) {
var defaultDialogSettings = editor.getParam("media_dialog_defaults", {});
tinymce.each(defaultDialogSettings, function(v, k) {
setVal(k, v);
});
}
};
tinyMCEPopup.requireLangPack();
tinyMCEPopup.onInit.add(function() {
Media.init();
});
})();

View File

@ -1,922 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{#media_dlg.title}</title>
<script type="text/javascript" src="../../tiny_mce_popup.js?ver=359-20131010"></script>
<script type="text/javascript" src="js/media.js?ver=359-20131010"></script>
<script type="text/javascript" src="../../utils/mctabs.js?ver=359-20131010"></script>
<script type="text/javascript" src="../../utils/validate.js?ver=359-20131010"></script>
<script type="text/javascript" src="../../utils/form_utils.js?ver=359-20131010"></script>
<script type="text/javascript" src="../../utils/editable_selects.js?ver=359-20131010"></script>
<link href="css/media.css?ver=359-20131010" rel="stylesheet" type="text/css" />
</head>
<body style="display: none" role="application">
<form onsubmit="Media.insert();return false;" action="#">
<div class="tabs" role="presentation">
<ul>
<li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');Media.formToData();" onmousedown="return false;">{#media_dlg.general}</a></span></li>
<li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');Media.formToData();" onmousedown="return false;">{#media_dlg.advanced}</a></span></li>
<li id="source_tab" aria-controls="source_panel"><span><a href="javascript:mcTabs.displayTab('source_tab','source_panel');Media.formToData('source');" onmousedown="return false;">{#media_dlg.source}</a></span></li>
</ul>
</div>
<div class="panel_wrapper">
<div id="general_panel" class="panel current">
<fieldset>
<legend>{#media_dlg.general}</legend>
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
<tr>
<td><label for="media_type">{#media_dlg.type}</label></td>
<td>
<select id="media_type"></select>
</td>
</tr>
<tr>
<td><label for="src">{#media_dlg.file}</label></td>
<td>
<table role="presentation" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input id="src" name="src" type="text" value="" class="mceFocus" onchange="Media.formToData();" /></td>
<td id="filebrowsercontainer">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr id="linklistrow">
<td><label for="linklist">{#media_dlg.list}</label></td>
<td id="linklistcontainer"><select id="linklist"><option value=""></option></select></td>
</tr>
<tr>
<td><label for="width">{#media_dlg.size}</label></td>
<td>
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="text" id="width" name="width" value="" class="size" onchange="Media.formToData('width');" onfocus="Media.beforeResize();" /> x <input type="text" id="height" name="height" value="" class="size" onfocus="Media.beforeResize();" onchange="Media.formToData('height');" /></td>
<td>&nbsp;&nbsp;<input id="constrain" type="checkbox" name="constrain" class="checkbox" checked="checked" /></td>
<td><label id="constrainlabel" for="constrain">{#media_dlg.constrain_proportions}</label></td>
</tr>
</table>
</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>{#media_dlg.preview}</legend>
<div id="prev"></div>
</fieldset>
</div>
<div id="advanced_panel" class="panel">
<fieldset>
<legend>{#media_dlg.advanced}</legend>
<table role="presentation" border="0" cellpadding="4" cellspacing="0" width="100%">
<tr>
<td><label for="id">{#media_dlg.id}</label></td>
<td><input type="text" id="id" name="id" onchange="Media.formToData();" /></td>
<td><label for="name">{#media_dlg.name}</label></td>
<td><input type="text" id="name" name="name" onchange="Media.formToData();" /></td>
</tr>
<tr>
<td><label for="align">{#media_dlg.align}</label></td>
<td>
<select id="align" name="align" onchange="Media.formToData();">
<option value="">{#not_set}</option>
<option value="top">{#media_dlg.align_top}</option>
<option value="right">{#media_dlg.align_right}</option>
<option value="bottom">{#media_dlg.align_bottom}</option>
<option value="left">{#media_dlg.align_left}</option>
</select>
</td>
<td><label for="bgcolor">{#media_dlg.bgcolor}</label></td>
<td>
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');Media.formToData();" /></td>
<td id="bgcolor_pickcontainer">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><label for="vspace">{#media_dlg.vspace}</label></td>
<td><input type="text" id="vspace" name="vspace" class="number" onchange="Media.formToData();" /></td>
<td><label for="hspace">{#media_dlg.hspace}</label></td>
<td><input type="text" id="hspace" name="hspace" class="number" onchange="Media.formToData();" /></td>
</tr>
</table>
</fieldset>
<fieldset id="video_options">
<legend>{#media_dlg.html5_video_options}</legend>
<table role="presentation">
<tr>
<td><label for="video_altsource1">{#media_dlg.altsource1}</label></td>
<td>
<table role="presentation" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="text" id="video_altsource1" name="video_altsource1" onchange="Media.formToData();" style="width: 240px" /></td>
<td id="video_altsource1_filebrowser">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><label for="video_altsource2">{#media_dlg.altsource2}</label></td>
<td>
<table role="presentation" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="text" id="video_altsource2" name="video_altsource2" onchange="Media.formToData();" style="width: 240px" /></td>
<td id="video_altsource2_filebrowser">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><label for="video_poster">{#media_dlg.poster}</label></td>
<td>
<table role="presentation" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="text" id="video_poster" name="video_poster" onchange="Media.formToData();" style="width: 240px" /></td>
<td id="video_poster_filebrowser">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><label for="video_preload">{#media_dlg.preload}</label></td>
<td>
<select id="video_preload" name="video_preload" onchange="Media.formToData();">
<option value="none">{#media_dlg.preload_none}</option>
<option value="metadata">{#media_dlg.preload_metadata}</option>
<option value="auto">{#media_dlg.preload_auto}</option>
</select>
</td>
</tr>
</table>
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
<tr>
<td>
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="video_autoplay" name="video_autoplay" onchange="Media.formToData();" /></td>
<td><label for="video_autoplay">{#media_dlg.play}</label></td>
</tr>
</table>
</td>
<td>
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="video_muted" name="video_muted" onchange="Media.formToData();" /></td>
<td><label for="video_muted">{#media_dlg.mute}</label></td>
</tr>
</table>
</td>
<td>
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="video_loop" name="video_loop" onchange="Media.formToData();" /></td>
<td><label for="video_loop">{#media_dlg.loop}</label></td>
</tr>
</table>
</td>
<td>
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="video_controls" name="video_controls" onchange="Media.formToData();" /></td>
<td><label for="video_controls">{#media_dlg.controls}</label></td>
</tr>
</table>
</td>
</tr>
</table>
</fieldset>
<fieldset id="embeddedaudio_options">
<legend>{#media_dlg.embedded_audio_options}</legend>
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
<tr>
<td>
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="embeddedaudio_autoplay" name="audio_autoplay" onchange="Media.formToData();" /></td>
<td><label for="audio_autoplay">{#media_dlg.play}</label></td>
</tr>
</table>
</td>
<td>
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="embeddedaudio_loop" name="audio_loop" onchange="Media.formToData();" /></td>
<td><label for="audio_loop">{#media_dlg.loop}</label></td>
</tr>
</table>
</td>
<td>
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="embeddedaudio_controls" name="audio_controls" onchange="Media.formToData();" /></td>
<td><label for="audio_controls">{#media_dlg.controls}</label></td>
</tr>
</table>
</td>
</tr>
</table>
</fieldset>
<fieldset id="audio_options">
<legend>{#media_dlg.html5_audio_options}</legend>
<table role="presentation">
<tr>
<td><label for="audio_altsource1">{#media_dlg.altsource1}</label></td>
<td>
<table role="presentation" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="text" id="audio_altsource1" name="audio_altsource1" onchange="Media.formToData();" style="width: 240px" /></td>
<td id="audio_altsource1_filebrowser">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><label for="audio_altsource2">{#media_dlg.altsource2}</label></td>
<td>
<table role="presentation" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="text" id="audio_altsource2" name="audio_altsource2" onchange="Media.formToData();" style="width: 240px" /></td>
<td id="audio_altsource2_filebrowser">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><label for="audio_preload">{#media_dlg.preload}</label></td>
<td>
<select id="audio_preload" name="audio_preload" onchange="Media.formToData();">
<option value="none">{#media_dlg.preload_none}</option>
<option value="metadata">{#media_dlg.preload_metadata}</option>
<option value="auto">{#media_dlg.preload_auto}</option>
</select>
</td>
</tr>
</table>
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
<tr>
<td>
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="audio_autoplay" name="audio_autoplay" onchange="Media.formToData();" /></td>
<td><label for="audio_autoplay">{#media_dlg.play}</label></td>
</tr>
</table>
</td>
<td>
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="audio_loop" name="audio_loop" onchange="Media.formToData();" /></td>
<td><label for="audio_loop">{#media_dlg.loop}</label></td>
</tr>
</table>
</td>
<td>
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="audio_controls" name="audio_controls" onchange="Media.formToData();" /></td>
<td><label for="audio_controls">{#media_dlg.controls}</label></td>
</tr>
</table>
</td>
</tr>
</table>
</fieldset>
<fieldset id="flash_options">
<legend>{#media_dlg.flash_options}</legend>
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
<tr>
<td><label for="flash_quality">{#media_dlg.quality}</label></td>
<td>
<select id="flash_quality" name="flash_quality" onchange="Media.formToData();">
<option value="">{#not_set}</option>
<option value="high">high</option>
<option value="low">low</option>
<option value="autolow">autolow</option>
<option value="autohigh">autohigh</option>
<option value="best">best</option>
</select>
</td>
<td><label for="flash_scale">{#media_dlg.scale}</label></td>
<td>
<select id="flash_scale" name="flash_scale" onchange="Media.formToData();">
<option value="">{#not_set}</option>
<option value="showall">showall</option>
<option value="noborder">noborder</option>
<option value="exactfit">exactfit</option>
<option value="noscale">noscale</option>
</select>
</td>
</tr>
<tr>
<td><label for="flash_wmode">{#media_dlg.wmode}</label></td>
<td>
<select id="flash_wmode" name="flash_wmode" onchange="Media.formToData();">
<option value="">{#not_set}</option>
<option value="window">window</option>
<option value="opaque">opaque</option>
<option value="transparent">transparent</option>
</select>
</td>
<td><label for="flash_salign">{#media_dlg.salign}</label></td>
<td>
<select id="flash_salign" name="flash_salign" onchange="Media.formToData();">
<option value="">{#not_set}</option>
<option value="l">{#media_dlg.align_left}</option>
<option value="t">{#media_dlg.align_top}</option>
<option value="r">{#media_dlg.align_right}</option>
<option value="b">{#media_dlg.align_bottom}</option>
<option value="tl">{#media_dlg.align_top_left}</option>
<option value="tr">{#media_dlg.align_top_right}</option>
<option value="bl">{#media_dlg.align_bottom_left}</option>
<option value="br">{#media_dlg.align_bottom_right}</option>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="flash_play" name="flash_play" checked="checked" onchange="Media.formToData();" /></td>
<td><label for="flash_play">{#media_dlg.play}</label></td>
</tr>
</table>
</td>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="flash_loop" name="flash_loop" checked="checked" onchange="Media.formToData();" /></td>
<td><label for="flash_loop">{#media_dlg.loop}</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="flash_menu" name="flash_menu" checked="checked" onchange="Media.formToData();" /></td>
<td><label for="flash_menu">{#media_dlg.menu}</label></td>
</tr>
</table>
</td>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="flash_swliveconnect" name="flash_swliveconnect" onchange="Media.formToData();" /></td>
<td><label for="flash_swliveconnect">{#media_dlg.liveconnect}</label></td>
</tr>
</table>
</td>
</tr>
</table>
<table role="presentation">
<tr>
<td><label for="flash_base">{#media_dlg.base}</label></td>
<td><input type="text" id="flash_base" name="flash_base" onchange="Media.formToData();" /></td>
</tr>
<tr>
<td><label for="flash_flashvars">{#media_dlg.flashvars}</label></td>
<td><input type="text" id="flash_flashvars" name="flash_flashvars" onchange="Media.formToData();" /></td>
</tr>
</table>
</fieldset>
<fieldset id="quicktime_options">
<legend>{#media_dlg.qt_options}</legend>
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="quicktime_loop" name="quicktime_loop" onchange="Media.formToData();" /></td>
<td><label for="quicktime_loop">{#media_dlg.loop}</label></td>
</tr>
</table>
</td>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="quicktime_autoplay" name="quicktime_autoplay" checked="checked" onchange="Media.formToData();" /></td>
<td><label for="quicktime_autoplay">{#media_dlg.play}</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="quicktime_cache" name="quicktime_cache" onchange="Media.formToData();" /></td>
<td><label for="quicktime_cache">{#media_dlg.cache}</label></td>
</tr>
</table>
</td>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="quicktime_controller" name="quicktime_controller" checked="checked" onchange="Media.formToData();" /></td>
<td><label for="quicktime_controller">{#media_dlg.controller}</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="quicktime_correction" name="quicktime_correction" onchange="Media.formToData();" /></td>
<td><label for="quicktime_correction">{#media_dlg.correction}</label></td>
</tr>
</table>
</td>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="quicktime_enablejavascript" name="quicktime_enablejavascript" onchange="Media.formToData();" /></td>
<td><label for="quicktime_enablejavascript">{#media_dlg.enablejavascript}</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="quicktime_kioskmode" name="quicktime_kioskmode" onchange="Media.formToData();" /></td>
<td><label for="quicktime_kioskmode">{#media_dlg.kioskmode}</label></td>
</tr>
</table>
</td>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="quicktime_autohref" name="quicktime_autohref" onchange="Media.formToData();" /></td>
<td><label for="quicktime_autohref">{#media_dlg.autohref}</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="quicktime_playeveryframe" name="quicktime_playeveryframe" onchange="Media.formToData();" /></td>
<td><label for="quicktime_playeveryframe">{#media_dlg.playeveryframe}</label></td>
</tr>
</table>
</td>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="quicktime_targetcache" name="quicktime_targetcache" onchange="Media.formToData();" /></td>
<td><label for="quicktime_targetcache">{#media_dlg.targetcache}</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><label for="quicktime_scale">{#media_dlg.scale}</label></td>
<td><select id="quicktime_scale" name="quicktime_scale" class="mceEditableSelect" onchange="Media.formToData();">
<option value="">{#not_set}</option>
<option value="tofit">tofit</option>
<option value="aspect">aspect</option>
</select>
</td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td><label for="quicktime_starttime">{#media_dlg.starttime}</label></td>
<td><input type="text" id="quicktime_starttime" name="quicktime_starttime" onchange="Media.formToData();" /></td>
<td><label for="quicktime_endtime">{#media_dlg.endtime}</label></td>
<td><input type="text" id="quicktime_endtime" name="quicktime_endtime" onchange="Media.formToData();" /></td>
</tr>
<tr>
<td><label for="quicktime_target">{#media_dlg.target}</label></td>
<td><input type="text" id="quicktime_target" name="quicktime_target" onchange="Media.formToData();" /></td>
<td><label for="quicktime_href">{#media_dlg.href}</label></td>
<td><input type="text" id="quicktime_href" name="quicktime_href" onchange="Media.formToData();" /></td>
</tr>
<tr>
<td><label for="quicktime_qtsrcchokespeed">{#media_dlg.qtsrcchokespeed}</label></td>
<td><input type="text" id="quicktime_qtsrcchokespeed" name="quicktime_qtsrcchokespeed" onchange="Media.formToData();" /></td>
<td><label for="quicktime_volume">{#media_dlg.volume}</label></td>
<td><input type="text" id="quicktime_volume" name="quicktime_volume" onchange="Media.formToData();" /></td>
</tr>
<tr>
<td><label for="quicktime_qtsrc">{#media_dlg.qtsrc}</label></td>
<td colspan="4">
<table role="presentation" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="text" id="quicktime_qtsrc" name="quicktime_qtsrc" onchange="Media.formToData();" /></td>
<td id="qtsrcfilebrowsercontainer">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</fieldset>
<fieldset id="windowsmedia_options">
<legend>{#media_dlg.wmp_options}</legend>
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="windowsmedia_autostart" name="windowsmedia_autostart" checked="checked" onchange="Media.formToData();" /></td>
<td><label for="windowsmedia_autostart">{#media_dlg.autostart}</label></td>
</tr>
</table>
</td>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="windowsmedia_enabled" name="windowsmedia_enabled" onchange="Media.formToData();" /></td>
<td><label for="windowsmedia_enabled">{#media_dlg.enabled}</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="windowsmedia_enablecontextmenu" name="windowsmedia_enablecontextmenu" checked="checked" onchange="Media.formToData();" /></td>
<td><label for="windowsmedia_enablecontextmenu">{#media_dlg.menu}</label></td>
</tr>
</table>
</td>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="windowsmedia_fullscreen" name="windowsmedia_fullscreen" onchange="Media.formToData();" /></td>
<td><label for="windowsmedia_fullscreen">{#media_dlg.fullscreen}</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="windowsmedia_invokeurls" name="windowsmedia_invokeurls" checked="checked" onchange="Media.formToData();" /></td>
<td><label for="windowsmedia_invokeurls">{#media_dlg.invokeurls}</label></td>
</tr>
</table>
</td>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="windowsmedia_mute" name="windowsmedia_mute" onchange="Media.formToData();" /></td>
<td><label for="windowsmedia_mute">{#media_dlg.mute}</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="windowsmedia_stretchtofit" name="windowsmedia_stretchtofit" onchange="Media.formToData();" /></td>
<td><label for="windowsmedia_stretchtofit">{#media_dlg.stretchtofit}</label></td>
</tr>
</table>
</td>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="windowsmedia_windowlessvideo" name="windowsmedia_windowlessvideo" onchange="Media.formToData();" /></td>
<td><label for="windowsmedia_windowlessvideo">{#media_dlg.windowlessvideo}</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><label for="windowsmedia_balance">{#media_dlg.balance}</label></td>
<td><input type="text" id="windowsmedia_balance" name="windowsmedia_balance" onchange="Media.formToData();" /></td>
<td><label for="windowsmedia_baseurl">{#media_dlg.baseurl}</label></td>
<td><input type="text" id="windowsmedia_baseurl" name="windowsmedia_baseurl" onchange="Media.formToData();" /></td>
</tr>
<tr>
<td><label for="windowsmedia_captioningid">{#media_dlg.captioningid}</label></td>
<td><input type="text" id="windowsmedia_captioningid" name="windowsmedia_captioningid" onchange="Media.formToData();" /></td>
<td><label for="windowsmedia_currentmarker">{#media_dlg.currentmarker}</label></td>
<td><input type="text" id="windowsmedia_currentmarker" name="windowsmedia_currentmarker" onchange="Media.formToData();" /></td>
</tr>
<tr>
<td><label for="windowsmedia_currentposition">{#media_dlg.currentposition}</label></td>
<td><input type="text" id="windowsmedia_currentposition" name="windowsmedia_currentposition" onchange="Media.formToData();" /></td>
<td><label for="windowsmedia_defaultframe">{#media_dlg.defaultframe}</label></td>
<td><input type="text" id="windowsmedia_defaultframe" name="windowsmedia_defaultframe" onchange="Media.formToData();" /></td>
</tr>
<tr>
<td><label for="windowsmedia_playcount">{#media_dlg.playcount}</label></td>
<td><input type="text" id="windowsmedia_playcount" name="windowsmedia_playcount" onchange="Media.formToData();" /></td>
<td><label for="windowsmedia_rate">{#media_dlg.rate}</label></td>
<td><input type="text" id="windowsmedia_rate" name="windowsmedia_rate" onchange="Media.formToData();" /></td>
</tr>
<tr>
<td><label for="windowsmedia_uimode">{#media_dlg.uimode}</label></td>
<td><input type="text" id="windowsmedia_uimode" name="windowsmedia_uimode" onchange="Media.formToData();" /></td>
<td><label for="windowsmedia_volume">{#media_dlg.volume}</label></td>
<td><input type="text" id="windowsmedia_volume" name="windowsmedia_volume" onchange="Media.formToData();" /></td>
</tr>
</table>
</fieldset>
<fieldset id="realmedia_options">
<legend>{#media_dlg.rmp_options}</legend>
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="realmedia_autostart" name="realmedia_autostart" onchange="Media.formToData();" /></td>
<td><label for="realmedia_autostart">{#media_dlg.autostart}</label></td>
</tr>
</table>
</td>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="realmedia_loop" name="realmedia_loop" onchange="Media.formToData();" /></td>
<td><label for="realmedia_loop">{#media_dlg.loop}</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="realmedia_autogotourl" name="realmedia_autogotourl" checked="checked" onchange="Media.formToData();" /></td>
<td><label for="realmedia_autogotourl">{#media_dlg.autogotourl}</label></td>
</tr>
</table>
</td>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="realmedia_center" name="realmedia_center" onchange="Media.formToData();" /></td>
<td><label for="realmedia_center">{#media_dlg.center}</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="realmedia_imagestatus" name="realmedia_imagestatus" checked="checked" onchange="Media.formToData();" /></td>
<td><label for="realmedia_imagestatus">{#media_dlg.imagestatus}</label></td>
</tr>
</table>
</td>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="realmedia_maintainaspect" name="realmedia_maintainaspect" onchange="Media.formToData();" /></td>
<td><label for="realmedia_maintainaspect">{#media_dlg.maintainaspect}</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="realmedia_nojava" name="realmedia_nojava" onchange="Media.formToData();" /></td>
<td><label for="realmedia_nojava">{#media_dlg.nojava}</label></td>
</tr>
</table>
</td>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="realmedia_prefetch" name="realmedia_prefetch" onchange="Media.formToData();" /></td>
<td><label for="realmedia_prefetch">{#media_dlg.prefetch}</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="realmedia_shuffle" name="realmedia_shuffle" onchange="Media.formToData();" /></td>
<td><label for="realmedia_shuffle">{#media_dlg.shuffle}</label></td>
</tr>
</table>
</td>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td><label for="realmedia_console">{#media_dlg.console}</label></td>
<td><input type="text" id="realmedia_console" name="realmedia_console" onchange="Media.formToData();" /></td>
<td><label for="realmedia_controls">{#media_dlg.controls}</label></td>
<td><input type="text" id="realmedia_controls" name="realmedia_controls" onchange="Media.formToData();" /></td>
</tr>
<tr>
<td><label for="realmedia_numloop">{#media_dlg.numloop}</label></td>
<td><input type="text" id="realmedia_numloop" name="realmedia_numloop" onchange="Media.formToData();" /></td>
<td><label for="realmedia_scriptcallbacks">{#media_dlg.scriptcallbacks}</label></td>
<td><input type="text" id="realmedia_scriptcallbacks" name="realmedia_scriptcallbacks" onchange="Media.formToData();" /></td>
</tr>
</table>
</fieldset>
<fieldset id="shockwave_options">
<legend>{#media_dlg.shockwave_options}</legend>
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
<tr>
<td><label for="shockwave_swstretchstyle">{#media_dlg.swstretchstyle}</label></td>
<td>
<select id="shockwave_swstretchstyle" name="shockwave_swstretchstyle" onchange="Media.formToData();">
<option value="none">{#not_set}</option>
<option value="meet">Meet</option>
<option value="fill">Fill</option>
<option value="stage">Stage</option>
</select>
</td>
<td><label for="shockwave_swvolume">{#media_dlg.volume}</label></td>
<td><input type="text" id="shockwave_swvolume" name="shockwave_swvolume" onchange="Media.formToData();" /></td>
</tr>
<tr>
<td><label for="shockwave_swstretchhalign">{#media_dlg.swstretchhalign}</label></td>
<td>
<select id="shockwave_swstretchhalign" name="shockwave_swstretchhalign" onchange="Media.formToData();">
<option value="none">{#not_set}</option>
<option value="left">{#media_dlg.align_left}</option>
<option value="center">{#media_dlg.align_center}</option>
<option value="right">{#media_dlg.align_right}</option>
</select>
</td>
<td><label for="shockwave_swstretchvalign">{#media_dlg.swstretchvalign}</label></td>
<td>
<select id="shockwave_swstretchvalign" name="shockwave_swstretchvalign" onchange="Media.formToData();">
<option value="none">{#not_set}</option>
<option value="meet">Meet</option>
<option value="fill">Fill</option>
<option value="stage">Stage</option>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="shockwave_autostart" name="shockwave_autostart" onchange="Media.formToData();" checked="checked" /></td>
<td><label for="shockwave_autostart">{#media_dlg.autostart}</label></td>
</tr>
</table>
</td>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="shockwave_sound" name="shockwave_sound" onchange="Media.formToData();" checked="checked" /></td>
<td><label for="shockwave_sound">{#media_dlg.sound}</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="shockwave_swliveconnect" name="shockwave_swliveconnect" onchange="Media.formToData();" /></td>
<td><label for="shockwave_swliveconnect">{#media_dlg.liveconnect}</label></td>
</tr>
</table>
</td>
<td colspan="2">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="shockwave_progress" name="shockwave_progress" onchange="Media.formToData();" checked="checked" /></td>
<td><label for="shockwave_progress">{#media_dlg.progress}</label></td>
</tr>
</table>
</td>
</tr>
</table>
</fieldset>
</div>
<div id="source_panel" class="panel">
<fieldset>
<legend>{#media_dlg.source}</legend>
<textarea id="source" style="width: 99%; height: 390px"></textarea>
</fieldset>
</div>
</div>
<div class="mceActionPanel">
<input type="submit" id="insert" name="insert" value="{#insert}" />
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>
</html>

View File

@ -0,0 +1,654 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*jshint maxlen:255 */
/*global tinymce:true */
tinymce.PluginManager.add('media', function(editor, url) {
var urlPatterns = [
{regex: /youtu\.be\/([a-z1-9.-_]+)/, type: 'iframe', w: 425, h: 350, url: 'http://www.youtube.com/embed/$1'},
{regex: /youtube\.com(.+)v=([^&]+)/, type: 'iframe', w: 425, h: 350, url: 'http://www.youtube.com/embed/$2'},
{regex: /vimeo\.com\/([0-9]+)/, type: 'iframe', w: 425, h: 350, url: 'http://player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc'},
{regex: /maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/, type: 'iframe', w: 425, h: 350, url: 'http://maps.google.com/maps/ms?msid=$2&output=embed"'}
];
function guessMime(url) {
if (url.indexOf('.mp3') != -1) {
return 'audio/mpeg';
}
if (url.indexOf('.wav') != -1) {
return 'audio/wav';
}
if (url.indexOf('.mp4') != -1) {
return 'video/mp4';
}
if (url.indexOf('.webm') != -1) {
return 'video/webm';
}
if (url.indexOf('.ogg') != -1) {
return 'video/ogg';
}
if (url.indexOf('.swf') != -1) {
return 'application/x-shockwave-flash';
}
return '';
}
function getVideoScriptMatch(src) {
var prefixes = editor.settings.media_scripts;
if (prefixes) {
for (var i = 0; i < prefixes.length; i++) {
if (src.indexOf(prefixes[i].filter) !== -1) {
return prefixes[i];
}
}
}
}
function showDialog() {
var win, width, height, data;
function recalcSize(e) {
var widthCtrl, heightCtrl, newWidth, newHeight;
widthCtrl = win.find('#width')[0];
heightCtrl = win.find('#height')[0];
newWidth = widthCtrl.value();
newHeight = heightCtrl.value();
if (win.find('#constrain')[0].checked() && width && height && newWidth && newHeight) {
if (e.control == widthCtrl) {
newHeight = Math.round((newWidth / width) * newHeight);
heightCtrl.value(newHeight);
} else {
newWidth = Math.round((newHeight / height) * newWidth);
widthCtrl.value(newWidth);
}
}
width = newWidth;
height = newHeight;
}
data = getData(editor.selection.getNode());
width = data.width;
height = data.height;
win = editor.windowManager.open({
title: 'Insert/edit video',
data: data,
bodyType: 'tabpanel',
body: [
{
title: 'General',
type: "form",
onShowTab: function() {
data = htmlToData(this.next().find('#embed').value());
this.fromJSON(data);
},
items: [
{name: 'source1', type: 'filepicker', filetype: 'media', size: 40, autofocus: true, label: 'Source'},
{name: 'source2', type: 'filepicker', filetype: 'media', size: 40, label: 'Alternative source'},
{name: 'poster', type: 'filepicker', filetype: 'image', size: 40, label: 'Poster'},
{
type: 'container',
label: 'Dimensions',
layout: 'flex',
align: 'center',
spacing: 5,
items: [
{name: 'width', type: 'textbox', maxLength: 3, size: 3, onchange: recalcSize},
{type: 'label', text: 'x'},
{name: 'height', type: 'textbox', maxLength: 3, size: 3, onchange: recalcSize},
{name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions'}
]
}
]
},
{
title: 'Embed',
type: "panel",
layout: 'flex',
direction: 'column',
align: 'stretch',
padding: 10,
spacing: 10,
onShowTab: function() {
this.find('#embed').value(dataToHtml(this.parent().toJSON()));
},
items: [
{
type: 'label',
text: 'Paste your embed code below:'
},
{
type: 'textbox',
flex: 1,
name: 'embed',
value: getSource(),
multiline: true,
label: 'Source'
}
]
}
],
onSubmit: function() {
editor.insertContent(dataToHtml(this.toJSON()));
}
});
}
function getSource() {
var elm = editor.selection.getNode();
if (elm.getAttribute('data-mce-object')) {
return editor.selection.getContent();
}
}
function dataToHtml(data) {
var html = '';
if (!data.source1) {
tinymce.extend(data, htmlToData(data.embed));
if (!data.source1) {
return '';
}
}
data.source1 = editor.convertURL(data.source1, "source");
data.source2 = editor.convertURL(data.source2, "source");
data.source1mime = guessMime(data.source1);
data.source2mime = guessMime(data.source2);
data.poster = editor.convertURL(data.poster, "poster");
data.flashPlayerUrl = editor.convertURL(url + '/moxieplayer.swf', "movie");
if (data.embed) {
html = updateHtml(data.embed, data, true);
} else {
tinymce.each(urlPatterns, function(pattern) {
var match, i, url;
if ((match = pattern.regex.exec(data.source1))) {
url = pattern.url;
for (i = 0; match[i]; i++) {
/*jshint loopfunc:true*/
url = url.replace('$' + i, function() {
return match[i];
});
}
data.source1 = url;
data.type = pattern.type;
data.width = pattern.w;
data.height = pattern.h;
}
});
var videoScript = getVideoScriptMatch(data.source1);
if (videoScript) {
data.type = 'script';
data.width = videoScript.width;
data.height = videoScript.height;
}
data.width = data.width || 300;
data.height = data.height || 150;
tinymce.each(data, function(value, key) {
data[key] = editor.dom.encode(value);
});
if (data.type == "iframe") {
html += '<iframe src="' + data.source1 + '" width="' + data.width + '" height="' + data.height + '"></iframe>';
} else if (data.source1mime == "application/x-shockwave-flash") {
html += '<object data="' + data.source1 + '" width="' + data.width + '" height="' + data.height + '" type="application/x-shockwave-flash">';
if (data.poster) {
html += '<img src="' + data.poster + '" width="' + data.width + '" height="' + data.height + '" />';
}
html += '</object>';
} else if (data.source1mime.indexOf('audio') != -1) {
if (editor.settings.audio_template_callback) {
html = editor.settings.audio_template_callback(data);
} else {
html += (
'<audio controls="controls" src="' + data.source1 + '">' +
(data.source2 ? '\n<source src="' + data.source2 + '"' + (data.source2mime ? ' type="' + data.source2mime + '"' : '') + ' />\n' : '') +
'</audio>'
);
}
} else if (data.type == "script") {
html += '<script src="' + data.source1 + '"></script>';
} else {
if (editor.settings.video_template_callback) {
html = editor.settings.video_template_callback(data);
} else {
html = (
'<video width="' + data.width + '" height="' + data.height + '"' + (data.poster ? ' poster="' + data.poster + '"' : '') + ' controls="controls">\n' +
'<source src="' + data.source1 + '"' + (data.source1mime ? ' type="' + data.source1mime + '"' : '') + ' />\n' +
(data.source2 ? '<source src="' + data.source2 + '"' + (data.source2mime ? ' type="' + data.source2mime + '"' : '') + ' />\n' : '') +
'</video>'
);
}
}
}
return html;
}
function htmlToData(html) {
var data = {};
new tinymce.html.SaxParser({
validate: false,
allow_conditional_comments: true,
special: 'script,noscript',
start: function(name, attrs) {
if (!data.source1 && name == "param") {
data.source1 = attrs.map.movie;
}
if (name == "iframe" || name == "object" || name == "embed" || name == "video" || name == "audio") {
if (!data.type) {
data.type = name;
}
data = tinymce.extend(attrs.map, data);
}
if (name == "script") {
var videoScript = getVideoScriptMatch(attrs.map.src);
if (!videoScript) {
return;
}
data = {
type: "script",
source1: attrs.map.src,
width: videoScript.width,
height: videoScript.height
};
}
if (name == "source") {
if (!data.source1) {
data.source1 = attrs.map.src;
} else if (!data.source2) {
data.source2 = attrs.map.src;
}
}
if (name == "img" && !data.poster) {
data.poster = attrs.map.src;
}
}
}).parse(html);
data.source1 = data.source1 || data.src || data.data;
data.source2 = data.source2 || '';
data.poster = data.poster || '';
return data;
}
function getData(element) {
if (element.getAttribute('data-mce-object')) {
return htmlToData(editor.serializer.serialize(element, {selection: true}));
}
return {};
}
function updateHtml(html, data, updateAll) {
var writer = new tinymce.html.Writer();
var sourceCount = 0, hasImage;
function setAttributes(attrs, updatedAttrs) {
var name, i, value, attr;
for (name in updatedAttrs) {
value = "" + updatedAttrs[name];
if (attrs.map[name]) {
i = attrs.length;
while (i--) {
attr = attrs[i];
if (attr.name == name) {
if (value) {
attrs.map[name] = value;
attr.value = value;
} else {
delete attrs.map[name];
attrs.splice(i, 1);
}
}
}
} else if (value) {
attrs.push({
name: name,
value: value
});
attrs.map[name] = value;
}
}
}
new tinymce.html.SaxParser({
validate: false,
allow_conditional_comments: true,
special: 'script,noscript',
comment: function(text) {
writer.comment(text);
},
cdata: function(text) {
writer.cdata(text);
},
text: function(text, raw) {
writer.text(text, raw);
},
start: function(name, attrs, empty) {
switch (name) {
case "video":
case "object":
case "embed":
case "img":
case "iframe":
setAttributes(attrs, {
width: data.width,
height: data.height
});
break;
}
if (updateAll) {
switch (name) {
case "video":
setAttributes(attrs, {
poster: data.poster,
src: ""
});
if (data.source2) {
setAttributes(attrs, {
src: ""
});
}
break;
case "iframe":
setAttributes(attrs, {
src: data.source1
});
break;
case "source":
sourceCount++;
if (sourceCount <= 2) {
setAttributes(attrs, {
src: data["source" + sourceCount],
type: data["source" + sourceCount + "mime"]
});
if (!data["source" + sourceCount]) {
return;
}
}
break;
case "img":
if (!data.poster) {
return;
}
hasImage = true;
break;
}
}
writer.start(name, attrs, empty);
},
end: function(name) {
if (name == "video" && updateAll) {
for (var index = 1; index <= 2; index++) {
if (data["source" + index]) {
var attrs = [];
attrs.map = {};
if (sourceCount < index) {
setAttributes(attrs, {
src: data["source" + index],
type: data["source" + index + "mime"]
});
writer.start("source", attrs, true);
}
}
}
}
if (data.poster && name == "object" && updateAll && !hasImage) {
var imgAttrs = [];
imgAttrs.map = {};
setAttributes(imgAttrs, {
src: data.poster,
width: data.width,
height: data.height
});
writer.start("img", imgAttrs, true);
}
writer.end(name);
}
}, new tinymce.html.Schema({})).parse(html);
return writer.getContent();
}
editor.on('ResolveName', function(e) {
var name;
if (e.target.nodeType == 1 && (name = e.target.getAttribute("data-mce-object"))) {
e.name = name;
}
});
editor.on('preInit', function() {
// Make sure that any messy HTML is retained inside these
var specialElements = editor.schema.getSpecialElements();
tinymce.each('video audio iframe object'.split(' '), function(name) {
specialElements[name] = new RegExp('<\/' + name + '[^>]*>','gi');
});
// Allow elements
editor.schema.addValidElements('object[id|style|width|height|classid|codebase|*],embed[id|style|width|height|type|src|*],video[*],audio[*]');
// Set allowFullscreen attribs as boolean
var boolAttrs = editor.schema.getBoolAttrs();
tinymce.each('webkitallowfullscreen mozallowfullscreen allowfullscreen'.split(' '), function(name) {
boolAttrs[name] = {};
});
// Converts iframe, video etc into placeholder images
editor.parser.addNodeFilter('iframe,video,audio,object,embed,script', function(nodes, name) {
var i = nodes.length, ai, node, placeHolder, attrName, attrValue, attribs, innerHtml;
var videoScript;
while (i--) {
node = nodes[i];
if (node.name == 'script') {
videoScript = getVideoScriptMatch(node.attr('src'));
if (!videoScript) {
continue;
}
}
placeHolder = new tinymce.html.Node('img', 1);
placeHolder.shortEnded = true;
if (videoScript) {
if (videoScript.width) {
node.attr('width', videoScript.width.toString());
}
if (videoScript.height) {
node.attr('height', videoScript.height.toString());
}
}
// Prefix all attributes except width, height and style since we
// will add these to the placeholder
attribs = node.attributes;
ai = attribs.length;
while (ai--) {
attrName = attribs[ai].name;
attrValue = attribs[ai].value;
if (attrName !== "width" && attrName !== "height" && attrName !== "style") {
if (attrName == "data" || attrName == "src") {
attrValue = editor.convertURL(attrValue, attrName);
}
placeHolder.attr('data-mce-p-' + attrName, attrValue);
}
}
// Place the inner HTML contents inside an escaped attribute
// This enables us to copy/paste the fake object
innerHtml = node.firstChild && node.firstChild.value;
if (innerHtml) {
placeHolder.attr("data-mce-html", escape(innerHtml));
placeHolder.firstChild = null;
}
placeHolder.attr({
width: node.attr('width') || "300",
height: node.attr('height') || (name == "audio" ? "30" : "150"),
style: node.attr('style'),
src: tinymce.Env.transparentSrc,
"data-mce-object": name,
"class": "mce-object mce-object-" + name
});
node.replace(placeHolder);
}
});
// Replaces placeholder images with real elements for video, object, iframe etc
editor.serializer.addAttributeFilter('data-mce-object', function(nodes, name) {
var i = nodes.length, node, realElm, ai, attribs, innerHtml, innerNode, realElmName;
while (i--) {
node = nodes[i];
realElmName = node.attr(name);
realElm = new tinymce.html.Node(realElmName, 1);
// Add width/height to everything but audio
if (realElmName != "audio" && realElmName != "script") {
realElm.attr({
width: node.attr('width'),
height: node.attr('height')
});
}
realElm.attr({
style: node.attr('style')
});
// Unprefix all placeholder attributes
attribs = node.attributes;
ai = attribs.length;
while (ai--) {
var attrName = attribs[ai].name;
if (attrName.indexOf('data-mce-p-') === 0) {
realElm.attr(attrName.substr(11), attribs[ai].value);
}
}
if (realElmName == "script") {
realElm.attr('type', 'text/javascript');
}
// Inject innerhtml
innerHtml = node.attr('data-mce-html');
if (innerHtml) {
innerNode = new tinymce.html.Node('#text', 3);
innerNode.raw = true;
innerNode.value = unescape(innerHtml);
realElm.append(innerNode);
}
node.replace(realElm);
}
});
});
editor.on('ObjectSelected', function(e) {
var objectType = e.target.getAttribute('data-mce-object');
if (objectType == "audio" || objectType == "script") {
e.preventDefault();
}
});
editor.on('objectResized', function(e) {
var target = e.target, html;
if (target.getAttribute('data-mce-object')) {
html = target.getAttribute('data-mce-html');
if (html) {
html = unescape(html);
target.setAttribute('data-mce-html', escape(
updateHtml(html, {
width: e.width,
height: e.height
})
));
}
}
});
editor.addButton('media', {
tooltip: 'Insert/edit video',
onclick: showDialog,
stateSelector: 'img[data-mce-object=video]'
});
editor.addMenuItem('media', {
icon: 'media',
text: 'Insert video',
onclick: showDialog,
context: 'insert',
prependToContext: true
});
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,885 +0,0 @@
/**
* editor_plugin_src.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
var each = tinymce.each,
defs = {
paste_auto_cleanup_on_paste : true,
paste_enable_default_filters : 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_max_consecutive_linebreaks: 2,
paste_text_use_dialog : false,
paste_text_sticky : false,
paste_text_sticky_default : false,
paste_text_notifyalways : false,
paste_text_linebreaktype : "combined",
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;
t.editor = ed;
t.url = url;
// Setup plugin events
t.onPreProcess = new tinymce.util.Dispatcher(t);
t.onPostProcess = new tinymce.util.Dispatcher(t);
// Register default handlers
t.onPreProcess.add(t._preProcess);
t.onPostProcess.add(t._postProcess);
// Register optional preprocess handler
t.onPreProcess.add(function(pl, o) {
ed.execCallback('paste_preprocess', pl, o);
});
// Register optional postprocess
t.onPostProcess.add(function(pl, o) {
ed.execCallback('paste_postprocess', pl, o);
});
ed.onKeyDown.addToTop(function(ed, e) {
// Block ctrl+v from adding an undo level since the default logic in tinymce.Editor will add that
if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
return false; // Stop other listeners
});
// Initialize plain text flag
ed.pasteAsPlainText = getParam(ed, 'paste_text_sticky_default');
// This function executes the process handlers and inserts the contents
// force_rich overrides plain text mode set by user, important for pasting with execCommand
function process(o, force_rich) {
var dom = ed.dom, rng;
// Execute pre process handlers
t.onPreProcess.dispatch(t, o);
// Create DOM structure
o.node = dom.create('div', 0, o.content);
// If pasting inside the same element and the contents is only one block
// remove the block and keep the text since Firefox will copy parts of pre and h1-h6 as a pre element
if (tinymce.isGecko) {
rng = ed.selection.getRng(true);
if (rng.startContainer == rng.endContainer && rng.startContainer.nodeType == 3) {
// Is only one block node and it doesn't contain word stuff
if (o.node.childNodes.length === 1 && /^(p|h[1-6]|pre)$/i.test(o.node.firstChild.nodeName) && o.content.indexOf('__MCE_ITEM__') === -1)
dom.remove(o.node.firstChild, true);
}
}
// Execute post process handlers
t.onPostProcess.dispatch(t, o);
// Serialize content
o.content = ed.serializer.serialize(o.node, {getInner : 1, forced_root_block : ''});
// Plain text option active?
if ((!force_rich) && (ed.pasteAsPlainText)) {
t._insertPlainText(o.content);
if (!getParam(ed, "paste_text_sticky")) {
ed.pasteAsPlainText = false;
ed.controlManager.setActive("pastetext", false);
}
} else {
t._insert(o.content);
}
}
// Add command for external usage
ed.addCommand('mceInsertClipboardContent', function(u, 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'));
}
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, oldRng, sel = ed.selection, dom = ed.dom, body = ed.getBody(), posY, textContent;
// Check if browser supports direct plaintext access
if (e.clipboardData || dom.doc.dataTransfer) {
textContent = (e.clipboardData || dom.doc.dataTransfer).getData('Text');
if (ed.pasteAsPlainText) {
e.preventDefault();
process({content : dom.encode(textContent).replace(/\r?\n/g, '<br />')});
return;
}
}
if (dom.get('_mcePaste'))
return;
// Create container to paste into
n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste', 'data-mce-bogus' : '1'}, '\uFEFF\uFEFF');
// If contentEditable mode we need to find out the position of the closest element
if (body != ed.getDoc().body)
posY = dom.getPos(ed.selection.getStart(), body).y;
else
posY = body.scrollTop + dom.getViewPort(ed.getWin()).y;
// Styles needs to be applied after the element is added to the document since WebKit will otherwise remove all styles
// If also needs to be in view on IE or the paste would fail
dom.setStyles(n, {
position : 'absolute',
left : tinymce.isGecko ? -40 : 0, // Need to move it out of site on Gecko since it will othewise display a ghost resize rect for the div
top : posY - 25,
width : 1,
height : 1,
overflow : 'hidden'
});
if (tinymce.isIE) {
// Store away the old range
oldRng = sel.getRng();
// Select the container
rng = dom.doc.body.createTextRange();
rng.moveToElementText(n);
rng.execCommand('Paste');
// 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\uFEFF') {
ed.execCommand('mcePasteWord');
e.preventDefault();
return;
}
// Restore the old range and clear the contents before pasting
sel.setRng(oldRng);
sel.setContent('');
// For some odd reason we need to detach the the mceInsertContent call from the paste event
// It's like IE has a reference to the parent element that you paste in and the selection gets messed up
// when it tries to restore the selection
setTimeout(function() {
// Process contents
process({content : n.innerHTML});
}, 0);
// 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 select contents inside DIV
n = n.firstChild;
rng = ed.getDoc().createRange();
rng.setStart(n, 0);
rng.setEnd(n, 2);
sel.setRng(rng);
// Wait a while and grab the pasted contents
window.setTimeout(function() {
var h = '', nl;
// Paste divs duplicated in paste divs seems to happen when you paste plain text so lets first look for that broken behavior in WebKit
if (!dom.select('div.mcePaste > div.mcePaste').length) {
nl = dom.select('div.mcePaste');
// 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;
// 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 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[data-mce-bogus]', n), function(n) {
dom.remove(n);
});
// WebKit will make a copy of the DIV for each line of plain text pasted and insert them into the DIV
if (n.parentNode.className != 'mcePaste')
h += n.innerHTML;
});
} else {
// Found WebKit weirdness so force the content into paragraphs this seems to happen when you paste plain text from Nodepad etc
// So this logic will replace double enter with paragraphs and single enter with br so it kind of looks the same
h = '<p>' + dom.encode(textContent).replace(/\r?\n\r?\n/g, '</p><p>').replace(/\r?\n/g, '<br />') + '</p>';
}
// Remove the nodes
each(dom.select('div.mcePaste'), 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 (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.addToTop(function(ed, e) {
if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
grabContent(e);
});
} else {
// Grab contents on paste event on Gecko and WebKit
ed.onPaste.addToTop(function(ed, e) {
return grabContent(e);
});
}
}
ed.onInit.add(function() {
ed.controlManager.setActive("pastetext", ed.pasteAsPlainText);
// Block all drag/drop events
if (getParam(ed, "paste_block_drop")) {
ed.dom.bind(ed.getBody(), ['dragend', 'dragover', 'draggesture', 'dragdrop', 'drop', 'drag'], function(e) {
e.preventDefault();
e.stopPropagation();
return false;
});
}
});
// Add legacy support
t._legacySupport();
},
getInfo : function() {
return {
longname : 'Paste text/word',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',
version : tinymce.majorVersion + "." + tinymce.minorVersion
};
},
_preProcess : function(pl, o) {
var ed = this.editor,
h = o.content,
grep = tinymce.grep,
explode = tinymce.explode,
trim = tinymce.trim,
len, stripClass;
//console.log('Before preprocess:' + o.content);
function process(items) {
each(items, function(v) {
// Remove or replace
if (v.constructor == RegExp)
h = h.replace(v, '');
else
h = h.replace(v[0], v[1]);
});
}
if (ed.settings.paste_enable_default_filters == false) {
return;
}
// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
if (tinymce.isIE && document.documentMode >= 9 && /<(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)/.test(o.content)) {
// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
process([[/(?:<br>&nbsp;[\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br>&nbsp;[\s\r\n]+|<br>)*/g, '$1']]);
// IE9 also adds an extra BR element for each soft-linefeed and it also adds a BR for each word wrap break
process([
[/<br><br>/g, '<BR><BR>'], // Replace multiple BR elements with uppercase BR to keep them intact
[/<br>/g, ' '], // Replace single br elements with space since they are word wrap BR:s
[/<BR><BR>/g, '<br>'] // Replace back the double brs but into a single BR
]);
}
// Detect Word content and process it more aggressive
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.');
// 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[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi, '$1__MCE_ITEM__'], // Convert mso-list and symbol spans to item markers
[/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi, '$1__MCE_ITEM__'] // Convert mso-list and symbol paragraphs to item markers (FF)
]);
}
process([
// 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 (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([
// 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;
}
}
]
]);
}
}
// 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>"]
]);
}
process([
// Copy paste from Java like Open Office will produce this junk on FF
[/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi, '']
]);
// 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 (getParam(ed, "paste_remove_spans")) {
h = h.replace(/<\/?span[^>]*>/gi, "");
}
//console.log('After preprocess:' + h);
o.content = h;
},
/**
* Various post process items.
*/
_postProcess : function(pl, o) {
var t = this, ed = t.editor, dom = ed.dom, styleProps;
if (ed.settings.paste_enable_default_filters == false) {
return;
}
if (o.wordContent) {
// Remove named anchors or TOC links
each(dom.select('a', o.node), function(a) {
if (!a.href || a.href.indexOf('#_Toc') != -1)
dom.remove(a, 1);
});
if (getParam(ed, "paste_convert_middot_lists")) {
t._convertLists(pl, o);
}
// Process styles
styleProps = getParam(ed, "paste_retain_style_properties"); // retained properties
// 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;
// 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++;
}
}
}
// 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);
});
}
}
// Remove all style information or only specifically on WebKit to avoid the style bug on that browser
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('data-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('data-mce-style');
});
}
}
},
/**
* Converts the most common bullet and number formats in Office into a real semantic UL/LI list.
*/
_convertLists : function(pl, o) {
var dom = pl.editor.dom, listElm, li, lastMargin = -1, margin, levels = [], lastType, html;
// Convert middot lists into real semantic lists
each(dom.select('p', o.node), function(p) {
var sib, val = '', type, html, idx, parents;
// Get text node value at beginning of paragraph
for (sib = p.firstChild; sib && sib.nodeType == 3; sib = sib.nextSibling)
val += sib.nodeValue;
val = p.innerHTML.replace(/<\/?\w+[^>]*>/gi, '').replace(/&nbsp;/g, '\u00a0');
// Detect unordered lists look for bullets
if (/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(val))
type = 'ul';
// Detect ordered lists 1., a. or ixv.
if (/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(val))
type = 'ol';
// Check if node value matches the list pattern: o&nbsp;&nbsp;
if (type) {
margin = parseFloat(p.style.marginLeft || 0);
if (margin > lastMargin)
levels.push(margin);
if (!listElm || type != lastType) {
listElm = dom.create(type);
dom.insertAfter(listElm, p);
} else {
// Nested list element
if (margin > lastMargin) {
listElm = li.appendChild(dom.create(type));
} else if (margin < lastMargin) {
// Find parent level based on margin value
idx = tinymce.inArray(levels, margin);
parents = dom.getParents(listElm.parentNode, type);
listElm = parents[parents.length - 1 - idx] || listElm;
}
}
// Remove middot or number spans if they exists
each(dom.select('span', p), function(span) {
var html = span.innerHTML.replace(/<\/?\w+[^>]*>/gi, '');
// Remove span with the middot or the number
if (type == 'ul' && /^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(html))
dom.remove(span);
else if (/^__MCE_ITEM__[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(html))
dom.remove(span);
});
html = p.innerHTML;
// Remove middot/list items
if (type == 'ul')
html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*(&nbsp;|\u00a0)+\s*/, '');
else
html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/, '');
// Create li and add paragraph data into the new li
li = listElm.appendChild(dom.create('li', 0, html));
dom.remove(p);
lastMargin = margin;
lastType = type;
} else
listElm = lastMargin = 0; // End list element
});
// Remove any left over makers
html = o.node.innerHTML;
if (html.indexOf('__MCE_ITEM__') != -1)
o.node.innerHTML = html.replace(/__MCE_ITEM__/g, '');
},
/**
* Inserts the specified contents at the caret position.
*/
_insert : function(h, skip_undo) {
var ed = this.editor, r = ed.selection.getRng();
// 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);
ed.execCommand('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(content) {
var ed = this.editor,
linebr = getParam(ed, "paste_text_linebreaktype"),
rl = getParam(ed, "paste_text_replacements"),
is = tinymce.is;
function process(items) {
each(items, function(v) {
if (v.constructor == RegExp)
content = content.replace(v, "");
else
content = content.replace(v[0], v[1]);
});
};
if ((typeof(content) === "string") && (content.length > 0)) {
// 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(content)) {
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*)
[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"] // Cool little RegExp deletes whitespace around linebreak chars.
]);
var maxLinebreaks = Number(getParam(ed, "paste_max_consecutive_linebreaks"));
if (maxLinebreaks > -1) {
var maxLinebreaksRegex = new RegExp("\n{" + (maxLinebreaks + 1) + ",}", "g");
var linebreakReplacement = "";
while (linebreakReplacement.length < maxLinebreaks) {
linebreakReplacement += "\n";
}
process([
[maxLinebreaksRegex, linebreakReplacement] // Limit max consecutive linebreaks
]);
}
content = ed.dom.decode(tinymce.html.Entities.encodeRaw(content));
// Perform default or custom replacements
if (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") {
// Convert all line breaks to space
process([
[/\n+/g, " "]
]);
} else if (linebr == "br") {
// Convert all line breaks to <br />
process([
[/\n/g, "<br />"]
]);
} else if (linebr == "p") {
// Convert all line breaks to <p>...</p>
process([
[/\n+/g, "</p><p>"],
[/^(.*<\/p>)(<p>)$/, '<p>$1']
]);
} else {
// defaults to "combined"
// Convert single line breaks to <br /> and double line breaks to <p>...</p>
process([
[/\n\n/g, "</p><p>"],
[/^(.*<\/p>)(<p>)$/, '<p>$1'],
[/\n/g, "<br />"]
]);
}
ed.execCommand('mceInsertContent', false, content);
}
},
/**
* 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 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
});
});
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);
})();

View File

@ -1,36 +0,0 @@
tinyMCEPopup.requireLangPack();
var PasteTextDialog = {
init : function() {
this.resize();
},
insert : function() {
var h = tinyMCEPopup.dom.encode(document.getElementById('content').value), lines;
// Convert linebreaks into paragraphs
if (document.getElementById('linebreaks').checked) {
lines = h.split(/\r?\n/);
if (lines.length > 1) {
h = '';
tinymce.each(lines, function(row) {
h += '<p>' + row + '</p>';
});
}
}
tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h});
tinyMCEPopup.close();
},
resize : function() {
var vp = tinyMCEPopup.dom.getViewPort(window), el;
el = document.getElementById('content');
el.style.width = (vp.w - 20) + 'px';
el.style.height = (vp.h - 90) + 'px';
}
};
tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog);

View File

@ -1,51 +0,0 @@
tinyMCEPopup.requireLangPack();
var PasteWordDialog = {
init : function() {
var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = '';
// Create iframe
el.innerHTML = '<iframe id="iframe" src="javascript:\'\';" frameBorder="0" style="border: 1px solid gray"></iframe>';
ifr = document.getElementById('iframe');
doc = ifr.contentWindow.document;
// Force absolute CSS urls
css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")];
css = css.concat(tinymce.explode(ed.settings.content_css) || []);
tinymce.each(css, function(u) {
cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute('' + u) + '" rel="stylesheet" type="text/css" />';
});
// Write content into iframe
doc.open();
doc.write('<html><head>' + cssHTML + '</head><body class="mceContentBody" spellcheck="false"></body></html>');
doc.close();
doc.designMode = 'on';
this.resize();
window.setTimeout(function() {
ifr.contentWindow.focus();
}, 10);
},
insert : function() {
var h = document.getElementById('iframe').contentWindow.document.body.innerHTML;
tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true});
tinyMCEPopup.close();
},
resize : function() {
var vp = tinyMCEPopup.dom.getViewPort(window), el;
el = document.getElementById('iframe');
if (el) {
el.style.width = (vp.w - 20) + 'px';
el.style.height = (vp.h - 90) + 'px';
}
}
};
tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog);

View File

@ -1,27 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{#paste.paste_text_desc}</title>
<script type="text/javascript" src="../../tiny_mce_popup.js?ver=359-20131010"></script>
<script type="text/javascript" src="js/pastetext.js?ver=359-20131010"></script>
</head>
<body onresize="PasteTextDialog.resize();" style="display:none; overflow:hidden;">
<form name="source" onsubmit="return PasteTextDialog.insert();" action="#">
<div style="float: left" class="title">{#paste.paste_text_desc}</div>
<div style="float: right">
<input type="checkbox" name="linebreaks" id="linebreaks" class="wordWrapCode" checked="checked" /><label for="linebreaks">{#paste_dlg.text_linebreaks}</label>
</div>
<br style="clear: both" />
<div>{#paste_dlg.text_title}</div>
<textarea id="content" name="content" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;" dir="ltr" wrap="soft" class="mceFocus"></textarea>
<div class="mceActionPanel">
<input type="submit" name="insert" value="{#insert}" id="insert" />
<input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
</div>
</form>
</body>
</html>

View File

@ -1,21 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{#paste.paste_word_desc}</title>
<script type="text/javascript" src="../../tiny_mce_popup.js?ver=359-20131010"></script>
<script type="text/javascript" src="js/pasteword.js?ver=359-20131010"></script>
</head>
<body onresize="PasteWordDialog.resize();" style="display:none; overflow:hidden;">
<form name="source" onsubmit="return PasteWordDialog.insert();" action="#">
<div class="title">{#paste.paste_word_desc}</div>
<div>{#paste_dlg.word_title}</div>
<div id="iframecontainer"></div>
<div class="mceActionPanel">
<input type="submit" id="insert" name="insert" value="{#insert}" />
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
* @package MCManager.includes
*/
// General settings
$config['general.engine'] = 'GoogleSpell';
// $config['general.engine'] = 'GoogleSpell';
//$config['general.engine'] = 'PSpell';
//$config['general.engine'] = 'PSpellShell';
//$config['general.remote_rpc_url'] = 'http://some.other.site/some/url/rpc.php';

View File

@ -1 +0,0 @@
.mceItemHiddenSpellWord {background:url(../img/wline.gif) repeat-x bottom left; cursor:default;}

File diff suppressed because one or more lines are too long

View File

@ -1,471 +0,0 @@
/**
* editor_plugin_src.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
var JSONRequest = tinymce.util.JSONRequest, each = tinymce.each, DOM = tinymce.DOM;
tinymce.create('tinymce.plugins.SpellcheckerPlugin', {
getInfo : function() {
return {
longname : 'Spellchecker',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker',
version : tinymce.majorVersion + "." + tinymce.minorVersion
};
},
init : function(ed, url) {
var t = this, cm;
t.url = url;
t.editor = ed;
t.rpcUrl = ed.getParam("spellchecker_rpc_url", "{backend}");
if (t.rpcUrl == '{backend}') {
// Sniff if the browser supports native spellchecking (Don't know of a better way)
if (tinymce.isIE)
return;
t.hasSupport = true;
// Disable the context menu when spellchecking is active
ed.onContextMenu.addToTop(function(ed, e) {
if (t.active)
return false;
});
}
// Register commands
ed.addCommand('mceSpellCheck', function() {
if (t.rpcUrl == '{backend}') {
// Enable/disable native spellchecker
t.editor.getBody().spellcheck = t.active = !t.active;
return;
}
if (!t.active) {
ed.setProgressState(1);
t._sendRPC('checkWords', [t.selectedLang, t._getWords()], function(r) {
if (r.length > 0) {
t.active = 1;
t._markWords(r);
ed.setProgressState(0);
ed.nodeChanged();
} else {
ed.setProgressState(0);
if (ed.getParam('spellchecker_report_no_misspellings', true))
ed.windowManager.alert('spellchecker.no_mpell');
}
});
} else
t._done();
});
if (ed.settings.content_css !== false)
ed.contentCSS.push(url + '/css/content.css');
ed.onClick.add(t._showMenu, t);
ed.onContextMenu.add(t._showMenu, t);
ed.onBeforeGetContent.add(function() {
if (t.active)
t._removeWords();
});
ed.onNodeChange.add(function(ed, cm) {
cm.setActive('spellchecker', t.active);
});
ed.onSetContent.add(function() {
t._done();
});
ed.onBeforeGetContent.add(function() {
t._done();
});
ed.onBeforeExecCommand.add(function(ed, cmd) {
if (cmd == 'mceFullScreen')
t._done();
});
// Find selected language
t.languages = {};
each(ed.getParam('spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv', 'hash'), function(v, k) {
if (k.indexOf('+') === 0) {
k = k.substring(1);
t.selectedLang = v;
}
t.languages[k] = v;
});
},
createControl : function(n, cm) {
var t = this, c, ed = t.editor;
if (n == 'spellchecker') {
// Use basic button if we use the native spellchecker
if (t.rpcUrl == '{backend}') {
// Create simple toggle button if we have native support
if (t.hasSupport)
c = cm.createButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t});
return c;
}
c = cm.createSplitButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t});
c.onRenderMenu.add(function(c, m) {
m.add({title : 'spellchecker.langs', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
t.menuItems = {};
each(t.languages, function(v, k) {
var o = {icon : 1}, mi;
o.onclick = function() {
if (v == t.selectedLang) {
return;
}
t._updateMenu(mi);
t.selectedLang = v;
};
o.title = k;
mi = m.add(o);
mi.setSelected(v == t.selectedLang);
t.menuItems[v] = mi;
if (v == t.selectedLang)
t.selectedItem = mi;
});
});
return c;
}
},
setLanguage: function(lang) {
var t = this;
if (lang == t.selectedLang) {
// allowed
return;
}
if (tinymce.grep(t.languages, function(v) { return v === lang; }).length === 0) {
throw "Unknown language: " + lang;
}
t.selectedLang = lang;
// if the menu has been shown, update it as well
if (t.menuItems) {
t._updateMenu(t.menuItems[lang]);
}
if (t.active) {
// clear error in the old language.
t._done();
// Don't immediately block the UI to check spelling in the new language, this is an API not a user action.
}
},
// Internal functions
_updateMenu: function(mi) {
mi.setSelected(1);
this.selectedItem.setSelected(0);
this.selectedItem = mi;
},
_walk : function(n, f) {
var d = this.editor.getDoc(), w;
if (d.createTreeWalker) {
w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
while ((n = w.nextNode()) != null)
f.call(this, n);
} else
tinymce.walk(n, f, 'childNodes');
},
_getSeparators : function() {
var re = '', i, str = this.editor.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');
// Build word separator regexp
for (i=0; i<str.length; i++)
re += '\\' + str.charAt(i);
return re;
},
_getWords : function() {
var ed = this.editor, wl = [], tx = '', lo = {}, rawWords = [];
// Get area text
this._walk(ed.getBody(), function(n) {
if (n.nodeType == 3)
tx += n.nodeValue + ' ';
});
// split the text up into individual words
if (ed.getParam('spellchecker_word_pattern')) {
// look for words that match the pattern
rawWords = tx.match('(' + ed.getParam('spellchecker_word_pattern') + ')', 'gi');
} else {
// Split words by separator
tx = tx.replace(new RegExp('([0-9]|[' + this._getSeparators() + '])', 'g'), ' ');
tx = tinymce.trim(tx.replace(/(\s+)/g, ' '));
rawWords = tx.split(' ');
}
// Build word array and remove duplicates
each(rawWords, function(v) {
if (!lo[v]) {
wl.push(v);
lo[v] = 1;
}
});
return wl;
},
_removeWords : function(w) {
var ed = this.editor, dom = ed.dom, se = ed.selection, r = se.getRng(true);
each(dom.select('span').reverse(), function(n) {
if (n && (dom.hasClass(n, 'mceItemHiddenSpellWord') || dom.hasClass(n, 'mceItemHidden'))) {
if (!w || dom.decode(n.innerHTML) == w)
dom.remove(n, 1);
}
});
se.setRng(r);
},
_markWords : function(wl) {
var ed = this.editor, dom = ed.dom, doc = ed.getDoc(), se = ed.selection, r = se.getRng(true), nl = [],
w = wl.join('|'), re = this._getSeparators(), rx = new RegExp('(^|[' + re + '])(' + w + ')(?=[' + re + ']|$)', 'g');
// Collect all text nodes
this._walk(ed.getBody(), function(n) {
if (n.nodeType == 3) {
nl.push(n);
}
});
// Wrap incorrect words in spans
each(nl, function(n) {
var node, elem, txt, pos, v = n.nodeValue;
rx.lastIndex = 0;
if (rx.test(v)) {
// Encode the content
v = dom.encode(v);
// Create container element
elem = dom.create('span', {'class' : 'mceItemHidden'});
// Following code fixes IE issues by creating text nodes
// using DOM methods instead of innerHTML.
// Bug #3124: <PRE> elements content is broken after spellchecking.
// Bug #1408: Preceding whitespace characters are removed
// @TODO: I'm not sure that both are still issues on IE9.
if (tinymce.isIE) {
// Enclose mispelled words with temporal tag
v = v.replace(rx, '$1<mcespell>$2</mcespell>');
// Loop over the content finding mispelled words
while ((pos = v.indexOf('<mcespell>')) != -1) {
// Add text node for the content before the word
txt = v.substring(0, pos);
if (txt.length) {
node = doc.createTextNode(dom.decode(txt));
elem.appendChild(node);
}
v = v.substring(pos+10);
pos = v.indexOf('</mcespell>');
txt = v.substring(0, pos);
v = v.substring(pos+11);
// Add span element for the word
elem.appendChild(dom.create('span', {'class' : 'mceItemHiddenSpellWord'}, txt));
}
// Add text node for the rest of the content
if (v.length) {
node = doc.createTextNode(dom.decode(v));
elem.appendChild(node);
}
} else {
// Other browsers preserve whitespace characters on innerHTML usage
elem.innerHTML = v.replace(rx, '$1<span class="mceItemHiddenSpellWord">$2</span>');
}
// Finally, replace the node with the container
dom.replace(elem, n);
}
});
se.setRng(r);
},
_showMenu : function(ed, e) {
var t = this, ed = t.editor, m = t._menu, p1, dom = ed.dom, vp = dom.getViewPort(ed.getWin()), wordSpan = e.target;
e = 0; // Fixes IE memory leak
if (!m) {
m = ed.controlManager.createDropMenu('spellcheckermenu', {'class' : 'mceNoIcons'});
t._menu = m;
}
if (dom.hasClass(wordSpan, 'mceItemHiddenSpellWord')) {
m.removeAll();
m.add({title : 'spellchecker.wait', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
t._sendRPC('getSuggestions', [t.selectedLang, dom.decode(wordSpan.innerHTML)], function(r) {
var ignoreRpc;
m.removeAll();
if (r.length > 0) {
m.add({title : 'spellchecker.sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
each(r, function(v) {
m.add({title : v, onclick : function() {
dom.replace(ed.getDoc().createTextNode(v), wordSpan);
t._checkDone();
}});
});
m.addSeparator();
} else
m.add({title : 'spellchecker.no_sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
if (ed.getParam('show_ignore_words', true)) {
ignoreRpc = t.editor.getParam("spellchecker_enable_ignore_rpc", '');
m.add({
title : 'spellchecker.ignore_word',
onclick : function() {
var word = wordSpan.innerHTML;
dom.remove(wordSpan, 1);
t._checkDone();
// tell the server if we need to
if (ignoreRpc) {
ed.setProgressState(1);
t._sendRPC('ignoreWord', [t.selectedLang, word], function(r) {
ed.setProgressState(0);
});
}
}
});
m.add({
title : 'spellchecker.ignore_words',
onclick : function() {
var word = wordSpan.innerHTML;
t._removeWords(dom.decode(word));
t._checkDone();
// tell the server if we need to
if (ignoreRpc) {
ed.setProgressState(1);
t._sendRPC('ignoreWords', [t.selectedLang, word], function(r) {
ed.setProgressState(0);
});
}
}
});
}
if (t.editor.getParam("spellchecker_enable_learn_rpc")) {
m.add({
title : 'spellchecker.learn_word',
onclick : function() {
var word = wordSpan.innerHTML;
dom.remove(wordSpan, 1);
t._checkDone();
ed.setProgressState(1);
t._sendRPC('learnWord', [t.selectedLang, word], function(r) {
ed.setProgressState(0);
});
}
});
}
m.update();
});
p1 = DOM.getPos(ed.getContentAreaContainer());
m.settings.offset_x = p1.x;
m.settings.offset_y = p1.y;
ed.selection.select(wordSpan);
p1 = dom.getPos(wordSpan);
m.showMenu(p1.x, p1.y + wordSpan.offsetHeight - vp.y);
return tinymce.dom.Event.cancel(e);
} else
m.hideMenu();
},
_checkDone : function() {
var t = this, ed = t.editor, dom = ed.dom, o;
each(dom.select('span'), function(n) {
if (n && dom.hasClass(n, 'mceItemHiddenSpellWord')) {
o = true;
return false;
}
});
if (!o)
t._done();
},
_done : function() {
var t = this, la = t.active;
if (t.active) {
t.active = 0;
t._removeWords();
if (t._menu)
t._menu.hideMenu();
if (la)
t.editor.nodeChanged();
}
},
_sendRPC : function(m, p, cb) {
var t = this;
JSONRequest.sendRPC({
url : t.rpcUrl,
method : m,
params : p,
success : cb,
error : function(e, x) {
t.editor.setProgressState(0);
t.editor.windowManager.alert(e.errstr || ('Error response: ' + x.responseText));
}
});
}
});
// Register plugin
tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin);
})();

View File

@ -0,0 +1,672 @@
/**
* Compiled inline version. (Library mode)
*/
/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */
/*globals $code */
(function(exports, undefined) {
"use strict";
var modules = {};
function require(ids, callback) {
var module, defs = [];
for (var i = 0; i < ids.length; ++i) {
module = modules[ids[i]] || resolve(ids[i]);
if (!module) {
throw 'module definition dependecy not found: ' + ids[i];
}
defs.push(module);
}
callback.apply(null, defs);
}
function define(id, dependencies, definition) {
if (typeof id !== 'string') {
throw 'invalid module definition, module id must be defined and be a string';
}
if (dependencies === undefined) {
throw 'invalid module definition, dependencies must be specified';
}
if (definition === undefined) {
throw 'invalid module definition, definition function must be specified';
}
require(dependencies, function() {
modules[id] = definition.apply(null, arguments);
});
}
function defined(id) {
return !!modules[id];
}
function resolve(id) {
var target = exports;
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length; ++fi) {
if (!target[fragments[fi]]) {
return;
}
target = target[fragments[fi]];
}
return target;
}
function expose(ids) {
for (var i = 0; i < ids.length; i++) {
var target = exports;
var id = ids[i];
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length - 1; ++fi) {
if (target[fragments[fi]] === undefined) {
target[fragments[fi]] = {};
}
target = target[fragments[fi]];
}
target[fragments[fragments.length - 1]] = modules[id];
}
}
// Included from: js/tinymce/plugins/spellchecker/classes/DomTextMatcher.js
/**
* DomTextMatcher.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/**
* This class logic for filtering text and matching words.
*
* @class tinymce.spellcheckerplugin.TextFilter
* @private
*/
define("tinymce/spellcheckerplugin/DomTextMatcher", [], function() {
// Based on work developed by: James Padolsey http://james.padolsey.com
// released under UNLICENSE that is compatible with LGPL
// TODO: Handle contentEditable edgecase:
// <p>text<span contentEditable="false">text<span contentEditable="true">text</span>text</span>text</p>
return function(regex, node, schema) {
var m, matches = [], text, count = 0, doc;
var blockElementsMap, hiddenTextElementsMap, shortEndedElementsMap;
doc = node.ownerDocument;
blockElementsMap = schema.getBlockElements(); // H1-H6, P, TD etc
hiddenTextElementsMap = schema.getWhiteSpaceElements(); // TEXTAREA, PRE, STYLE, SCRIPT
shortEndedElementsMap = schema.getShortEndedElements(); // BR, IMG, INPUT
function getMatchIndexes(m) {
if (!m[0]) {
throw 'findAndReplaceDOMText cannot handle zero-length matches';
}
var index = m.index;
return [index, index + m[0].length, [m[0]]];
}
function getText(node) {
var txt;
if (node.nodeType === 3) {
return node.data;
}
if (hiddenTextElementsMap[node.nodeName] && !blockElementsMap[node.nodeName]) {
return '';
}
txt = '';
if (blockElementsMap[node.nodeName] || shortEndedElementsMap[node.nodeName]) {
txt += '\n';
}
if ((node = node.firstChild)) {
do {
txt += getText(node);
} while ((node = node.nextSibling));
}
return txt;
}
function stepThroughMatches(node, matches, replaceFn) {
var startNode, endNode, startNodeIndex,
endNodeIndex, innerNodes = [], atIndex = 0, curNode = node,
matchLocation = matches.shift(), matchIndex = 0;
out: while (true) {
if (blockElementsMap[curNode.nodeName] || shortEndedElementsMap[curNode.nodeName]) {
atIndex++;
}
if (curNode.nodeType === 3) {
if (!endNode && curNode.length + atIndex >= matchLocation[1]) {
// We've found the ending
endNode = curNode;
endNodeIndex = matchLocation[1] - atIndex;
} else if (startNode) {
// Intersecting node
innerNodes.push(curNode);
}
if (!startNode && curNode.length + atIndex > matchLocation[0]) {
// We've found the match start
startNode = curNode;
startNodeIndex = matchLocation[0] - atIndex;
}
atIndex += curNode.length;
}
if (startNode && endNode) {
curNode = replaceFn({
startNode: startNode,
startNodeIndex: startNodeIndex,
endNode: endNode,
endNodeIndex: endNodeIndex,
innerNodes: innerNodes,
match: matchLocation[2],
matchIndex: matchIndex
});
// replaceFn has to return the node that replaced the endNode
// and then we step back so we can continue from the end of the
// match:
atIndex -= (endNode.length - endNodeIndex);
startNode = null;
endNode = null;
innerNodes = [];
matchLocation = matches.shift();
matchIndex++;
if (!matchLocation) {
break; // no more matches
}
} else if ((!hiddenTextElementsMap[curNode.nodeName] || blockElementsMap[curNode.nodeName]) && curNode.firstChild) {
// Move down
curNode = curNode.firstChild;
continue;
} else if (curNode.nextSibling) {
// Move forward:
curNode = curNode.nextSibling;
continue;
}
// Move forward or up:
while (true) {
if (curNode.nextSibling) {
curNode = curNode.nextSibling;
break;
} else if (curNode.parentNode !== node) {
curNode = curNode.parentNode;
} else {
break out;
}
}
}
}
/**
* Generates the actual replaceFn which splits up text nodes
* and inserts the replacement element.
*/
function genReplacer(nodeName) {
var makeReplacementNode;
if (typeof nodeName != 'function') {
var stencilNode = nodeName.nodeType ? nodeName : doc.createElement(nodeName);
makeReplacementNode = function(fill, matchIndex) {
var clone = stencilNode.cloneNode(false);
clone.setAttribute('data-mce-index', matchIndex);
if (fill) {
clone.appendChild(doc.createTextNode(fill));
}
return clone;
};
} else {
makeReplacementNode = nodeName;
}
return function replace(range) {
var before, after, parentNode, startNode = range.startNode,
endNode = range.endNode, matchIndex = range.matchIndex;
if (startNode === endNode) {
var node = startNode;
parentNode = node.parentNode;
if (range.startNodeIndex > 0) {
// Add `before` text node (before the match)
before = doc.createTextNode(node.data.substring(0, range.startNodeIndex));
parentNode.insertBefore(before, node);
}
// Create the replacement node:
var el = makeReplacementNode(range.match[0], matchIndex);
parentNode.insertBefore(el, node);
if (range.endNodeIndex < node.length) {
// Add `after` text node (after the match)
after = doc.createTextNode(node.data.substring(range.endNodeIndex));
parentNode.insertBefore(after, node);
}
node.parentNode.removeChild(node);
return el;
} else {
// Replace startNode -> [innerNodes...] -> endNode (in that order)
before = doc.createTextNode(startNode.data.substring(0, range.startNodeIndex));
after = doc.createTextNode(endNode.data.substring(range.endNodeIndex));
var elA = makeReplacementNode(startNode.data.substring(range.startNodeIndex), matchIndex);
var innerEls = [];
for (var i = 0, l = range.innerNodes.length; i < l; ++i) {
var innerNode = range.innerNodes[i];
var innerEl = makeReplacementNode(innerNode.data, matchIndex);
innerNode.parentNode.replaceChild(innerEl, innerNode);
innerEls.push(innerEl);
}
var elB = makeReplacementNode(endNode.data.substring(0, range.endNodeIndex), matchIndex);
parentNode = startNode.parentNode;
parentNode.insertBefore(before, startNode);
parentNode.insertBefore(elA, startNode);
parentNode.removeChild(startNode);
parentNode = endNode.parentNode;
parentNode.insertBefore(elB, endNode);
parentNode.insertBefore(after, endNode);
parentNode.removeChild(endNode);
return elB;
}
};
}
text = getText(node);
if (text && regex.global) {
while ((m = regex.exec(text))) {
matches.push(getMatchIndexes(m));
}
}
function filter(callback) {
var filteredMatches = [];
each(function(match, i) {
if (callback(match, i)) {
filteredMatches.push(match);
}
});
matches = filteredMatches;
/*jshint validthis:true*/
return this;
}
function each(callback) {
for (var i = 0, l = matches.length; i < l; i++) {
if (callback(matches[i], i) === false) {
break;
}
}
/*jshint validthis:true*/
return this;
}
function mark(replacementNode) {
if (matches.length) {
count = matches.length;
stepThroughMatches(node, matches, genReplacer(replacementNode));
}
/*jshint validthis:true*/
return this;
}
return {
text: text,
count: count,
matches: matches,
each: each,
filter: filter,
mark: mark
};
};
});
// Included from: js/tinymce/plugins/spellchecker/classes/Plugin.js
/**
* Plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*jshint camelcase:false */
/**
* This class contains all core logic for the spellchecker plugin.
*
* @class tinymce.spellcheckerplugin.Plugin
* @private
*/
define("tinymce/spellcheckerplugin/Plugin", [
"tinymce/spellcheckerplugin/DomTextMatcher",
"tinymce/PluginManager",
"tinymce/util/Tools",
"tinymce/ui/Menu",
"tinymce/dom/DOMUtils",
"tinymce/util/JSONRequest",
"tinymce/util/URI"
], function(DomTextMatcher, PluginManager, Tools, Menu, DOMUtils, JSONRequest, URI) {
PluginManager.add('spellchecker', function(editor, url) {
var lastSuggestions, started, suggestionsMenu, settings = editor.settings;
function isEmpty(obj) {
/*jshint unused:false*/
for (var name in obj) {
return false;
}
return true;
}
function showSuggestions(target, word) {
var items = [], suggestions = lastSuggestions[word];
Tools.each(suggestions, function(suggestion) {
items.push({
text: suggestion,
onclick: function() {
editor.insertContent(suggestion);
checkIfFinished();
}
});
});
items.push.apply(items, [
{text: '-'},
{text: 'Ignore', onclick: function() {
ignoreWord(target, word);
}},
{text: 'Ignore all', onclick: function() {
ignoreWord(target, word, true);
}},
{text: 'Finish', onclick: finish}
]);
// Render menu
suggestionsMenu = new Menu({
items: items,
context: 'contextmenu',
onautohide: function(e) {
if (e.target.className.indexOf('spellchecker') != -1) {
e.preventDefault();
}
},
onhide: function() {
suggestionsMenu.remove();
suggestionsMenu = null;
}
});
suggestionsMenu.renderTo(document.body);
// Position menu
var pos = DOMUtils.DOM.getPos(editor.getContentAreaContainer());
var targetPos = editor.dom.getPos(target);
pos.x += targetPos.x;
pos.y += targetPos.y;
suggestionsMenu.moveTo(pos.x, pos.y + target.offsetHeight);
}
function spellcheck() {
var textFilter, words = [], uniqueWords = {};
if (started) {
finish();
return;
}
started = true;
function doneCallback(suggestions) {
editor.setProgressState(false);
if (isEmpty(suggestions)) {
editor.windowManager.alert('No misspellings found');
started = false;
return;
}
lastSuggestions = suggestions;
textFilter.filter(function(match) {
return !!suggestions[match[2][0]];
}).mark(editor.dom.create('span', {
"class": 'mce-spellchecker-word',
"data-mce-bogus": 1
}));
textFilter = null;
editor.fire('SpellcheckStart');
}
// Regexp for finding word specific characters this will split words by
// spaces, quotes, copy right characters etc. It's escaped with unicode characters
// to make it easier to output scripts on servers using different encodings
// so if you add any characters outside the 128 byte range make sure to escape it
var nonWordSeparatorCharacters = editor.getParam('spellchecker_wordchar_pattern') || new RegExp("[^" +
"\\s!\"#$%&()*+,-./:;<=>?@[\\]^_{|}`" +
"\u00a7\u00a9\u00ab\u00ae\u00b1\u00b6\u00b7\u00b8\u00bb" +
"\u00bc\u00bd\u00be\u00bf\u00d7\u00f7\u00a4\u201d\u201c\u201e" +
"]+", "g");
// Find all words and make an unique words array
textFilter = new DomTextMatcher(nonWordSeparatorCharacters, editor.getBody(), editor.schema).each(function(match) {
var word = match[2][0];
// TODO: Fix so it remembers correctly spelled words
if (!uniqueWords[word]) {
// Ignore numbers and single character words
if (/^\d+$/.test(word) || word.length == 1) {
return;
}
words.push(word);
uniqueWords[word] = true;
}
});
function defaultSpellcheckCallback(method, words, doneCallback) {
JSONRequest.sendRPC({
url: new URI(url).toAbsolute(settings.spellchecker_rpc_url),
method: method,
params: {
lang: settings.spellchecker_language || "en",
words: words
},
success: function(result) {
doneCallback(result);
},
error: function(error, xhr) {
if (error == "JSON Parse error.") {
error = "Non JSON response:" + xhr.responseText;
} else {
error = "Error: " + error;
}
editor.windowManager.alert(error);
editor.setProgressState(false);
textFilter = null;
started = false;
}
});
}
editor.setProgressState(true);
var spellCheckCallback = settings.spellchecker_callback || defaultSpellcheckCallback;
spellCheckCallback("spellcheck", words, doneCallback);
}
function checkIfFinished() {
if (!editor.dom.select('span.mce-spellchecker-word').length) {
finish();
}
}
function unwrap(node) {
var parentNode = node.parentNode;
parentNode.insertBefore(node.firstChild, node);
node.parentNode.removeChild(node);
}
function ignoreWord(target, word, all) {
if (all) {
Tools.each(editor.dom.select('span.mce-spellchecker-word'), function(item) {
var text = item.innerText || item.textContent;
if (text == word) {
unwrap(item);
}
});
} else {
unwrap(target);
}
checkIfFinished();
}
function finish() {
var i, nodes, node;
started = false;
node = editor.getBody();
nodes = node.getElementsByTagName('span');
i = nodes.length;
while (i--) {
node = nodes[i];
if (node.getAttribute('data-mce-index')) {
unwrap(node);
}
}
editor.fire('SpellcheckEnd');
}
function selectMatch(index) {
var nodes, i, spanElm, spanIndex = -1, startContainer, endContainer;
index = "" + index;
nodes = editor.getBody().getElementsByTagName("span");
for (i = 0; i < nodes.length; i++) {
spanElm = nodes[i];
if (spanElm.className == "mce-spellchecker-word") {
spanIndex = spanElm.getAttribute('data-mce-index');
if (spanIndex === index) {
spanIndex = index;
if (!startContainer) {
startContainer = spanElm.firstChild;
}
endContainer = spanElm.firstChild;
}
if (spanIndex !== index && endContainer) {
break;
}
}
}
var rng = editor.dom.createRng();
rng.setStart(startContainer, 0);
rng.setEnd(endContainer, endContainer.length);
editor.selection.setRng(rng);
return rng;
}
editor.on('click', function(e) {
if (e.target.className == "mce-spellchecker-word") {
e.preventDefault();
var rng = selectMatch(e.target.getAttribute('data-mce-index'));
showSuggestions(e.target, rng.toString());
}
});
editor.addMenuItem('spellchecker', {
text: 'Spellcheck',
context: 'tools',
onclick: spellcheck,
selectable: true,
onPostRender: function() {
var self = this;
editor.on('SpellcheckStart SpellcheckEnd', function() {
self.active(started);
});
}
});
editor.addButton('spellchecker', {
tooltip: 'Spellcheck',
onclick: spellcheck,
onPostRender: function() {
var self = this;
editor.on('SpellcheckStart SpellcheckEnd', function() {
self.active(started);
});
}
});
editor.on('remove', function() {
if (suggestionsMenu) {
suggestionsMenu.remove();
suggestionsMenu = null;
}
});
});
});
expose(["tinymce/spellcheckerplugin/DomTextMatcher","tinymce/spellcheckerplugin/Plugin"]);
})(this);

File diff suppressed because one or more lines are too long

View File

@ -96,9 +96,10 @@ $input = $json->decode($raw);
if (isset($config['general.engine'])) {
$spellchecker = new $config['general.engine']($config);
$result = call_user_func_array(array($spellchecker, $input['method']), $input['params']);
} else
die('{"result":null,"id":null,"error":{"errstr":"You must choose an spellchecker engine in the config.php file.","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}');
} else {
// die('{"result":null,"id":null,"error":{"errstr":"You must choose an spellchecker engine in the config.php file.","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}');
die('{"error":"You must choose spellchecker engine in the config.php file."}');
}
// Request and response id should always be the same
$output = array(
"id" => $input->id,

View File

@ -1 +0,0 @@
(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(t){n=c.select(":input:enabled,*[tabindex]:not(iframe)");function s(v){return v.nodeName==="BODY"||(v.type!="hidden"&&!(v.style.display=="none")&&!(v.style.visibility=="hidden")&&s(v.parentNode))}function i(v){return v.attributes.tabIndex.specified||v.nodeName=="INPUT"||v.nodeName=="TEXTAREA"}function u(){return tinymce.isIE6||tinymce.isIE7}function r(v){return((!u()||i(v)))&&v.getAttribute("tabindex")!="-1"&&s(v)}d(n,function(w,v){if(w.id==l.id){j=v;return false}});if(t>0){for(m=j+1;m<n.length;m++){if(r(n[m])){return n[m]}}}else{for(m=j-1;m>=0;m--){if(r(n[m])){return n[m]}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(n.id&&(l=tinymce.get(n.id||n.name))){l.focus()}else{window.setTimeout(function(){if(!tinymce.isWebKit){window.focus()}n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})();

View File

@ -1,122 +0,0 @@
/**
* editor_plugin_src.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, explode = tinymce.explode;
tinymce.create('tinymce.plugins.TabFocusPlugin', {
init : function(ed, url) {
function tabCancel(ed, e) {
if (e.keyCode === 9)
return Event.cancel(e);
}
function tabHandler(ed, e) {
var x, i, f, el, v;
function find(d) {
el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');
function canSelectRecursive(e) {
return e.nodeName==="BODY" || (e.type != 'hidden' &&
!(e.style.display == "none") &&
!(e.style.visibility == "hidden") && canSelectRecursive(e.parentNode));
}
function canSelectInOldIe(el) {
return el.attributes["tabIndex"].specified || el.nodeName == "INPUT" || el.nodeName == "TEXTAREA";
}
function isOldIe() {
return tinymce.isIE6 || tinymce.isIE7;
}
function canSelect(el) {
return ((!isOldIe() || canSelectInOldIe(el))) && el.getAttribute("tabindex") != '-1' && canSelectRecursive(el);
}
each(el, function(e, i) {
if (e.id == ed.id) {
x = i;
return false;
}
});
if (d > 0) {
for (i = x + 1; i < el.length; i++) {
if (canSelect(el[i]))
return el[i];
}
} else {
for (i = x - 1; i >= 0; i--) {
if (canSelect(el[i]))
return el[i];
}
}
return null;
}
if (e.keyCode === 9) {
v = explode(ed.getParam('tab_focus', ed.getParam('tabfocus_elements', ':prev,:next')));
if (v.length == 1) {
v[1] = v[0];
v[0] = ':prev';
}
// Find element to focus
if (e.shiftKey) {
if (v[0] == ':prev')
el = find(-1);
else
el = DOM.get(v[0]);
} else {
if (v[1] == ':next')
el = find(1);
else
el = DOM.get(v[1]);
}
if (el) {
if (el.id && (ed = tinymce.get(el.id || el.name)))
ed.focus();
else
window.setTimeout(function() {
if (!tinymce.isWebKit)
window.focus();
el.focus();
}, 10);
return Event.cancel(e);
}
}
}
ed.onKeyUp.add(tabCancel);
if (tinymce.isGecko) {
ed.onKeyPress.add(tabHandler);
ed.onKeyDown.add(tabCancel);
} else
ed.onKeyDown.add(tabHandler);
},
getInfo : function() {
return {
longname : 'Tabfocus',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus',
version : tinymce.majorVersion + "." + tinymce.minorVersion
};
}
});
// Register plugin
tinymce.PluginManager.add('tabfocus', tinymce.plugins.TabFocusPlugin);
})();

View File

@ -0,0 +1,122 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('tabfocus', function(editor) {
var DOM = tinymce.DOM, each = tinymce.each, explode = tinymce.explode;
function tabCancel(e) {
if (e.keyCode === 9) {
e.preventDefault();
}
}
function tabHandler(e) {
var x, el, v, i;
function find(direction) {
el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');
function canSelectRecursive(e) {
return e.nodeName==="BODY" || (e.type != 'hidden' &&
e.style.display != "none" &&
e.style.visibility != "hidden" && canSelectRecursive(e.parentNode));
}
function canSelectInOldIe(el) {
return el.tabIndex || el.nodeName == "INPUT" || el.nodeName == "TEXTAREA";
}
function canSelect(el) {
return ((!canSelectInOldIe(el))) && el.getAttribute("tabindex") != '-1' && canSelectRecursive(el);
}
each(el, function(e, i) {
if (e.id == editor.id) {
x = i;
return false;
}
});
if (direction > 0) {
for (i = x + 1; i < el.length; i++) {
if (canSelect(el[i])) {
return el[i];
}
}
} else {
for (i = x - 1; i >= 0; i--) {
if (canSelect(el[i])) {
return el[i];
}
}
}
return null;
}
if (e.keyCode === 9) {
v = explode(editor.getParam('tab_focus', editor.getParam('tabfocus_elements', ':prev,:next')));
if (v.length == 1) {
v[1] = v[0];
v[0] = ':prev';
}
// Find element to focus
if (e.shiftKey) {
if (v[0] == ':prev') {
el = find(-1);
} else {
el = DOM.get(v[0]);
}
} else {
if (v[1] == ':next') {
el = find(1);
} else {
el = DOM.get(v[1]);
}
}
if (el) {
var focusEditor = tinymce.get(el.id || el.name);
if (el.id && focusEditor) {
focusEditor.focus();
} else {
window.setTimeout(function() {
if (!tinymce.Env.webkit) {
window.focus();
}
el.focus();
}, 10);
}
e.preventDefault();
}
}
}
editor.on('init', function() {
if (editor.inline) {
// Remove default tabIndex in inline mode
tinymce.DOM.setAttrib(editor.getBody(), 'tabIndex', null);
}
});
editor.on('keyup', tabCancel);
if (tinymce.Env.gecko) {
editor.on('keypress keydown', tabHandler);
} else {
editor.on('keydown', tabHandler);
}
});

View File

@ -0,0 +1 @@
tinymce.PluginManager.add("tabfocus",function(e){function n(e){9===e.keyCode&&e.preventDefault()}function t(n){function t(n){function t(e){return"BODY"===e.nodeName||"hidden"!=e.type&&"none"!=e.style.display&&"hidden"!=e.style.visibility&&t(e.parentNode)}function r(e){return e.tabIndex||"INPUT"==e.nodeName||"TEXTAREA"==e.nodeName}function a(e){return!r(e)&&"-1"!=e.getAttribute("tabindex")&&t(e)}if(d=i.select(":input:enabled,*[tabindex]:not(iframe)"),o(d,function(n,t){return n.id==e.id?(u=t,!1):void 0}),n>0){for(c=u+1;c<d.length;c++)if(a(d[c]))return d[c]}else for(c=u-1;c>=0;c--)if(a(d[c]))return d[c];return null}var u,d,a,c;if(9===n.keyCode&&(a=r(e.getParam("tab_focus",e.getParam("tabfocus_elements",":prev,:next"))),1==a.length&&(a[1]=a[0],a[0]=":prev"),d=n.shiftKey?":prev"==a[0]?t(-1):i.get(a[0]):":next"==a[1]?t(1):i.get(a[1]))){var f=tinymce.get(d.id||d.name);d.id&&f?f.focus():window.setTimeout(function(){tinymce.Env.webkit||window.focus(),d.focus()},10),n.preventDefault()}}var i=tinymce.DOM,o=tinymce.each,r=tinymce.explode;e.on("init",function(){e.inline&&tinymce.DOM.setAttrib(e.getBody(),"tabIndex",null)}),e.on("keyup",n),tinymce.Env.gecko?e.on("keypress keydown",t):e.on("keydown",t)});

View File

@ -0,0 +1,152 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('textcolor', function(editor) {
function mapColors() {
var i, colors = [], colorMap;
colorMap = editor.settings.textcolor_map || [
"000000", "Black",
"993300", "Burnt orange",
"333300", "Dark olive",
"003300", "Dark green",
"003366", "Dark azure",
"000080", "Navy Blue",
"333399", "Indigo",
"333333", "Very dark gray",
"800000", "Maroon",
"FF6600", "Orange",
"808000", "Olive",
"008000", "Green",
"008080", "Teal",
"0000FF", "Blue",
"666699", "Grayish blue",
"808080", "Gray",
"FF0000", "Red",
"FF9900", "Amber",
"99CC00", "Yellow green",
"339966", "Sea green",
"33CCCC", "Turquoise",
"3366FF", "Royal blue",
"800080", "Purple",
"999999", "Medium gray",
"FF00FF", "Magenta",
"FFCC00", "Gold",
"FFFF00", "Yellow",
"00FF00", "Lime",
"00FFFF", "Aqua",
"00CCFF", "Sky blue",
"993366", "Brown",
"C0C0C0", "Silver",
"FF99CC", "Pink",
"FFCC99", "Peach",
"FFFF99", "Light yellow",
"CCFFCC", "Pale green",
"CCFFFF", "Pale cyan",
"99CCFF", "Light sky blue",
"CC99FF", "Plum",
"FFFFFF", "White"
];
for (i = 0; i < colorMap.length; i += 2) {
colors.push({
text: colorMap[i + 1],
color: colorMap[i]
});
}
return colors;
}
function renderColorPicker() {
var ctrl = this, colors, color, html, last, rows, cols, x, y, i;
colors = mapColors();
html = '<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="presentation" cellspacing="0"><tbody>';
last = colors.length - 1;
rows = editor.settings.textcolor_rows || 5;
cols = editor.settings.textcolor_cols || 8;
for (y = 0; y < rows; y++) {
html += '<tr>';
for (x = 0; x < cols; x++) {
i = y * cols + x;
if (i > last) {
html += '<td></td>';
} else {
color = colors[i];
html += (
'<td>' +
'<div id="' + ctrl._id + '-' + i + '"' +
' data-mce-color="' + color.color + '"' +
' role="option"' +
' tabIndex="-1"' +
' style="' + (color ? 'background-color: #' + color.color : '') + '"' +
' title="' + color.text + '">' +
'</div>' +
'</td>'
);
}
}
html += '</tr>';
}
html += '</tbody></table>';
return html;
}
function onPanelClick(e) {
var buttonCtrl = this.parent(), value;
if ((value = e.target.getAttribute('data-mce-color'))) {
buttonCtrl.hidePanel();
value = '#' + value;
buttonCtrl.color(value);
editor.execCommand(buttonCtrl.settings.selectcmd, false, value);
}
}
function onButtonClick() {
var self = this;
if (self._color) {
editor.execCommand(self.settings.selectcmd, false, self._color);
}
}
editor.addButton('forecolor', {
type: 'colorbutton',
tooltip: 'Text color',
selectcmd: 'ForeColor',
panel: {
html: renderColorPicker,
onclick: onPanelClick
},
onclick: onButtonClick
});
editor.addButton('backcolor', {
type: 'colorbutton',
tooltip: 'Background color',
selectcmd: 'HiliteColor',
panel: {
html: renderColorPicker,
onclick: onPanelClick
},
onclick: onButtonClick
});
});

View File

@ -0,0 +1 @@
tinymce.PluginManager.add("textcolor",function(e){function o(){var o,t,r=[];for(t=e.settings.textcolor_map||["000000","Black","993300","Burnt orange","333300","Dark olive","003300","Dark green","003366","Dark azure","000080","Navy Blue","333399","Indigo","333333","Very dark gray","800000","Maroon","FF6600","Orange","808000","Olive","008000","Green","008080","Teal","0000FF","Blue","666699","Grayish blue","808080","Gray","FF0000","Red","FF9900","Amber","99CC00","Yellow green","339966","Sea green","33CCCC","Turquoise","3366FF","Royal blue","800080","Purple","999999","Medium gray","FF00FF","Magenta","FFCC00","Gold","FFFF00","Yellow","00FF00","Lime","00FFFF","Aqua","00CCFF","Sky blue","993366","Brown","C0C0C0","Silver","FF99CC","Pink","FFCC99","Peach","FFFF99","Light yellow","CCFFCC","Pale green","CCFFFF","Pale cyan","99CCFF","Light sky blue","CC99FF","Plum","FFFFFF","White"],o=0;o<t.length;o+=2)r.push({text:t[o+1],color:t[o]});return r}function t(){var t,r,l,c,n,a,F,i,d,u=this;for(t=o(),l='<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="presentation" cellspacing="0"><tbody>',c=t.length-1,n=e.settings.textcolor_rows||5,a=e.settings.textcolor_cols||8,i=0;n>i;i++){for(l+="<tr>",F=0;a>F;F++)d=i*a+F,d>c?l+="<td></td>":(r=t[d],l+='<td><div id="'+u._id+"-"+d+'"'+' data-mce-color="'+r.color+'"'+' role="option"'+' tabIndex="-1"'+' style="'+(r?"background-color: #"+r.color:"")+'"'+' title="'+r.text+'">'+"</div>"+"</td>");l+="</tr>"}return l+="</tbody></table>"}function r(o){var t,r=this.parent();(t=o.target.getAttribute("data-mce-color"))&&(r.hidePanel(),t="#"+t,r.color(t),e.execCommand(r.settings.selectcmd,!1,t))}function l(){var o=this;o._color&&e.execCommand(o.settings.selectcmd,!1,o._color)}e.addButton("forecolor",{type:"colorbutton",tooltip:"Text color",selectcmd:"ForeColor",panel:{html:t,onclick:r},onclick:l}),e.addButton("backcolor",{type:"colorbutton",tooltip:"Background color",selectcmd:"HiliteColor",panel:{html:t,onclick:r},onclick:l})});

File diff suppressed because one or more lines are too long

View File

@ -1,448 +0,0 @@
/* global tinymce, getUserSetting, setUserSetting, switchEditors, autosave */
/**
* WordPress plugin.
*/
(function() {
var DOM = tinymce.DOM;
tinymce.create('tinymce.plugins.WordPress', {
init : function(ed, url) {
var t = this, tbId = ed.getParam('wordpress_adv_toolbar', 'toolbar2'), last = 0, moreHTML, nextpageHTML, closeOnClick, mod_key, style;
moreHTML = '<img src="' + url + '/img/trans.gif" class="mce-wp-more mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mce-wp-nextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
if ( getUserSetting('hidetb', '0') == '1' )
ed.settings.wordpress_adv_hidden = 0;
// Hides the specified toolbar and resizes the iframe
ed.onPostRender.add(function() {
var adv_toolbar = ed.controlManager.get(tbId);
if ( ed.getParam('wordpress_adv_hidden', 1) && adv_toolbar ) {
DOM.hide(adv_toolbar.id);
t._resizeIframe(ed, tbId, 28);
}
});
// Register commands
ed.addCommand('WP_More', function() {
ed.execCommand('mceInsertContent', 0, moreHTML);
});
ed.addCommand('WP_Page', function() {
ed.execCommand('mceInsertContent', 0, nextpageHTML);
});
ed.addCommand('WP_Help', function() {
ed.windowManager.open({
url : tinymce.baseURL + '/wp-mce-help.php',
width : 450,
height : 420,
inline : 1
});
});
ed.addCommand('WP_Adv', function() {
var cm = ed.controlManager, id = cm.get(tbId).id;
if ( 'undefined' == id )
return;
if ( DOM.isHidden(id) ) {
cm.setActive('wp_adv', 1);
DOM.show(id);
t._resizeIframe(ed, tbId, -28);
ed.settings.wordpress_adv_hidden = 0;
setUserSetting('hidetb', '1');
} else {
cm.setActive('wp_adv', 0);
DOM.hide(id);
t._resizeIframe(ed, tbId, 28);
ed.settings.wordpress_adv_hidden = 1;
setUserSetting('hidetb', '0');
}
});
ed.addCommand('WP_Medialib', function() {
if ( typeof wp !== 'undefined' && wp.media && wp.media.editor )
wp.media.editor.open( ed.id );
});
// Register buttons
ed.addButton('wp_more', {
title : 'wordpress.wp_more_desc',
cmd : 'WP_More'
});
ed.addButton('wp_page', {
title : 'wordpress.wp_page_desc',
image : url + '/img/page.gif',
cmd : 'WP_Page'
});
ed.addButton('wp_help', {
title : 'wordpress.wp_help_desc',
cmd : 'WP_Help'
});
ed.addButton('wp_adv', {
title : 'wordpress.wp_adv_desc',
cmd : 'WP_Adv'
});
// Add Media button
ed.addButton('add_media', {
title : 'wordpress.add_media',
image : url + '/img/image.gif',
cmd : 'WP_Medialib'
});
// Add Media buttons to fullscreen and handle align buttons for image captions
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val, o) {
var DOM = tinymce.DOM, n, DL, DIV, cls, a, align;
if ( 'mceFullScreen' == cmd ) {
if ( 'mce_fullscreen' != ed.id && DOM.select('a.thickbox').length )
ed.settings.theme_advanced_buttons1 += ',|,add_media';
}
if ( 'JustifyLeft' == cmd || 'JustifyRight' == cmd || 'JustifyCenter' == cmd ) {
n = ed.selection.getNode();
if ( n.nodeName == 'IMG' ) {
align = cmd.substr(7).toLowerCase();
a = 'align' + align;
DL = ed.dom.getParent(n, 'dl.wp-caption');
DIV = ed.dom.getParent(n, 'div.mceTemp');
if ( DL && DIV ) {
cls = ed.dom.hasClass(DL, a) ? 'alignnone' : a;
DL.className = DL.className.replace(/align[^ '"]+\s?/g, '');
ed.dom.addClass(DL, cls);
if (cls == 'aligncenter')
ed.dom.addClass(DIV, 'mceIEcenter');
else
ed.dom.removeClass(DIV, 'mceIEcenter');
o.terminate = true;
ed.execCommand('mceRepaint');
} else {
if ( ed.dom.hasClass(n, a) )
ed.dom.addClass(n, 'alignnone');
else
ed.dom.removeClass(n, 'alignnone');
}
}
}
if ( tinymce.isWebKit && ( 'InsertUnorderedList' == cmd || 'InsertOrderedList' == cmd ) ) {
if ( !style )
style = ed.dom.create('style', {'type': 'text/css'}, '#tinymce,#tinymce span,#tinymce li,#tinymce li>span,#tinymce p,#tinymce p>span{font:medium sans-serif;color:#000;line-height:normal;}');
ed.getDoc().head.appendChild( style );
}
});
ed.onExecCommand.add( function( ed, cmd ) {
if ( tinymce.isWebKit && style && ( 'InsertUnorderedList' == cmd || 'InsertOrderedList' == cmd ) )
ed.dom.remove( style );
});
ed.onInit.add(function(ed) {
var bodyClass = ed.getParam('body_class', ''), body = ed.getBody();
// add body classes
if ( bodyClass )
bodyClass = bodyClass.split(' ');
else
bodyClass = [];
if ( ed.getParam('directionality', '') == 'rtl' )
bodyClass.push('rtl');
if ( tinymce.isIE9 )
bodyClass.push('ie9');
else if ( tinymce.isIE8 )
bodyClass.push('ie8');
else if ( tinymce.isIE7 )
bodyClass.push('ie7');
if ( ed.id != 'wp_mce_fullscreen' && ed.id != 'mce_fullscreen' )
bodyClass.push('wp-editor');
else if ( ed.id == 'mce_fullscreen' )
bodyClass.push('mce-fullscreen');
tinymce.each( bodyClass, function(cls){
if ( cls )
ed.dom.addClass(body, cls);
});
// make sure these run last
ed.onNodeChange.add( function(ed, cm, e) {
var DL;
if ( e.nodeName == 'IMG' ) {
DL = ed.dom.getParent(e, 'dl.wp-caption');
} else if ( e.nodeName == 'DIV' && ed.dom.hasClass(e, 'mceTemp') ) {
DL = e.firstChild;
if ( ! ed.dom.hasClass(DL, 'wp-caption') )
DL = false;
}
if ( DL ) {
if ( ed.dom.hasClass(DL, 'alignleft') )
cm.setActive('justifyleft', 1);
else if ( ed.dom.hasClass(DL, 'alignright') )
cm.setActive('justifyright', 1);
else if ( ed.dom.hasClass(DL, 'aligncenter') )
cm.setActive('justifycenter', 1);
}
});
// remove invalid parent paragraphs when pasting HTML and/or switching to the HTML editor and back
ed.onBeforeSetContent.add(function(ed, o) {
if ( o.content ) {
o.content = o.content.replace(/<p>\s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)( [^>]*)?>/gi, '<$1$2>');
o.content = o.content.replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)>\s*<\/p>/gi, '</$1>');
}
});
});
// Word count
if ( 'undefined' != typeof(jQuery) ) {
ed.onKeyUp.add(function(ed, e) {
var k = e.keyCode || e.charCode;
if ( k == last )
return;
if ( 13 == k || 8 == last || 46 == last )
jQuery(document).triggerHandler('wpcountwords', [ ed.getContent({format : 'raw'}) ]);
last = k;
});
}
// keep empty paragraphs :(
ed.onSaveContent.addToTop(function(ed, o) {
o.content = o.content.replace(/<p>(<br ?\/?>|\u00a0|\uFEFF)?<\/p>/g, '<p>&nbsp;</p>');
});
// Fix bug in iOS Safari where it's impossible to type after a touchstart event on the parent document.
// Happens after zooming in or out while the keyboard is open. See #25131.
if ( tinymce.isIOS5 ) {
ed.onKeyDown.add( function() {
if ( document.activeElement == document.body ) {
ed.getWin().focus();
}
});
}
ed.onSaveContent.add(function(ed, o) {
// If editor is hidden, we just want the textarea's value to be saved
if ( ed.isHidden() )
o.content = o.element.value;
else if ( ed.getParam('wpautop', true) && typeof(switchEditors) == 'object' )
o.content = switchEditors.pre_wpautop(o.content);
});
/* disable for now
ed.onBeforeSetContent.add(function(ed, o) {
o.content = t._setEmbed(o.content);
});
ed.onPostProcess.add(function(ed, o) {
if ( o.get )
o.content = t._getEmbed(o.content);
});
*/
// Add listeners to handle more break
t._handleMoreBreak(ed, url);
// Add custom shortcuts
mod_key = 'alt+shift';
// if ( tinymce.isGecko ) // disable for mow, too many shortcuts conflicts
// mod_key = 'ctrl+alt';
ed.addShortcut(mod_key + '+c', 'justifycenter_desc', 'JustifyCenter');
ed.addShortcut(mod_key + '+r', 'justifyright_desc', 'JustifyRight');
ed.addShortcut(mod_key + '+l', 'justifyleft_desc', 'JustifyLeft');
ed.addShortcut(mod_key + '+j', 'justifyfull_desc', 'JustifyFull');
ed.addShortcut(mod_key + '+q', 'blockquote_desc', 'mceBlockQuote');
ed.addShortcut(mod_key + '+u', 'bullist_desc', 'InsertUnorderedList');
ed.addShortcut(mod_key + '+o', 'numlist_desc', 'InsertOrderedList');
ed.addShortcut(mod_key + '+n', 'spellchecker.desc', 'mceSpellCheck');
ed.addShortcut(mod_key + '+a', 'link_desc', 'WP_Link');
ed.addShortcut(mod_key + '+s', 'unlink_desc', 'unlink');
ed.addShortcut(mod_key + '+m', 'image_desc', 'WP_Medialib');
ed.addShortcut(mod_key + '+z', 'wordpress.wp_adv_desc', 'WP_Adv');
ed.addShortcut(mod_key + '+t', 'wordpress.wp_more_desc', 'WP_More');
ed.addShortcut(mod_key + '+d', 'striketrough_desc', 'Strikethrough');
ed.addShortcut(mod_key + '+h', 'help_desc', 'WP_Help');
ed.addShortcut(mod_key + '+p', 'wordpress.wp_page_desc', 'WP_Page');
ed.addShortcut('ctrl+s', 'save_desc', function(){if('function'==typeof autosave)autosave();});
if ( /\bwpfullscreen\b/.test(ed.settings.plugins) )
ed.addShortcut(mod_key + '+w', 'wordpress.wp_fullscreen_desc', 'wpFullScreen');
else if ( /\bfullscreen\b/.test(ed.settings.plugins) )
ed.addShortcut(mod_key + '+g', 'fullscreen.desc', 'mceFullScreen');
// popup buttons for images and the gallery
ed.onInit.add(function(ed) {
tinymce.dom.Event.add(ed.getWin(), 'scroll', function() {
ed.plugins.wordpress._hideButtons();
});
tinymce.dom.Event.add(ed.getBody(), 'dragstart', function() {
ed.plugins.wordpress._hideButtons();
});
});
ed.onBeforeExecCommand.add( function( ed ) {
ed.plugins.wordpress._hideButtons();
});
ed.onSaveContent.add( function( ed ) {
ed.plugins.wordpress._hideButtons();
});
ed.onMouseDown.add(function(ed, e) {
if ( e.target.nodeName != 'IMG' )
ed.plugins.wordpress._hideButtons();
});
ed.onKeyDown.add(function(ed, e){
if ( e.which == tinymce.VK.DELETE || e.which == tinymce.VK.BACKSPACE )
ed.plugins.wordpress._hideButtons();
});
closeOnClick = function(e){
var id;
if ( e.target.id == 'mceModalBlocker' || e.target.className == 'ui-widget-overlay' ) {
for ( id in ed.windowManager.windows ) {
ed.windowManager.close(null, id);
}
}
};
// close popups when clicking on the background
tinymce.dom.Event.remove(document.body, 'click', closeOnClick);
tinymce.dom.Event.add(document.body, 'click', closeOnClick);
},
getInfo : function() {
return {
longname : 'WordPress Plugin',
author : 'WordPress', // add Moxiecode?
authorurl : 'http://wordpress.org',
infourl : 'http://wordpress.org',
version : '3.0'
};
},
// Internal functions
_setEmbed : function(c) {
return c.replace(/\[embed\]([\s\S]+?)\[\/embed\][\s\u00a0]*/g, function(a,b){
return '<img width="300" height="200" src="' + tinymce.baseURL + '/plugins/wordpress/img/trans.gif" class="wp-oembed mceItemNoResize" alt="'+b+'" title="'+b+'" />';
});
},
_getEmbed : function(c) {
return c.replace(/<img[^>]+>/g, function(a) {
if ( a.indexOf('class="wp-oembed') != -1 ) {
var u = a.match(/alt="([^\"]+)"/);
if ( u[1] )
a = '[embed]' + u[1] + '[/embed]';
}
return a;
});
},
_showButtons : function(n, id) {
var ed = tinymce.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y;
vp = ed.dom.getViewPort(ed.getWin());
p1 = DOM.getPos(ed.getContentAreaContainer());
p2 = ed.dom.getPos(n);
X = Math.max(p2.x - vp.x, 0) + p1.x;
Y = Math.max(p2.y - vp.y, 0) + p1.y;
DOM.setStyles(id, {
'top' : Y+5+'px',
'left' : X+5+'px',
'display' : 'block'
});
},
_hideButtons : function() {
var DOM = tinymce.DOM;
DOM.hide( DOM.select('#wp_editbtns, #wp_gallerybtns') );
},
// Resizes the iframe by a relative height value
_resizeIframe : function(ed, tb_id, dy) {
var ifr = ed.getContentAreaContainer().firstChild;
DOM.setStyle(ifr, 'height', ifr.clientHeight + dy); // Resize iframe
ed.theme.deltaHeight += dy; // For resize cookie
},
_handleMoreBreak : function(ed, url) {
var moreHTML, nextpageHTML;
moreHTML = '<img src="' + url + '/img/trans.gif" alt="$1" class="mce-wp-more mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mce-wp-nextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
// Display morebreak instead if img in element path
ed.onPostRender.add(function() {
if (ed.theme.onResolveName) {
ed.theme.onResolveName.add(function(th, o) {
if (o.node.nodeName == 'IMG') {
if ( ed.dom.hasClass(o.node, 'mce-wp-more') )
o.name = 'wpmore';
if ( ed.dom.hasClass(o.node, 'mce-wp-nextpage') )
o.name = 'wppage';
}
});
}
});
// Replace morebreak with images
ed.onBeforeSetContent.add(function(ed, o) {
if ( o.content ) {
o.content = o.content.replace(/<!--more(.*?)-->/g, moreHTML);
o.content = o.content.replace(/<!--nextpage-->/g, nextpageHTML);
}
});
// Replace images with morebreak
ed.onPostProcess.add(function(ed, o) {
if (o.get)
o.content = o.content.replace(/<img[^>]+>/g, function(im) {
if (im.indexOf('class="mce-wp-more') !== -1) {
var m, moretext = (m = im.match(/alt="(.*?)"/)) ? m[1] : '';
im = '<!--more'+moretext+'-->';
}
if (im.indexOf('class="mce-wp-nextpage') !== -1)
im = '<!--nextpage-->';
return im;
});
});
// Set active buttons if user selected pagebreak or more break
ed.onNodeChange.add(function(ed, cm, n) {
cm.setActive('wp_page', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mce-wp-nextpage'));
cm.setActive('wp_more', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mce-wp-more'));
});
}
});
// Register plugin
tinymce.PluginManager.add('wordpress', tinymce.plugins.WordPress);
})();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

View File

@ -0,0 +1,417 @@
/* global tinymce, autosave, getUserSetting, setUserSetting, switchEditors */
tinymce.PluginManager.add( 'wordpress', function( editor ) {
var DOM = tinymce.DOM, wpAdvButton, modKey, style,
last = 0;
function toggleToolbars( state ) {
var iframe,
pixels = 0,
initial = state === 'hide',
toolbars = editor.theme.panel && editor.theme.panel.find('.toolbar');
if ( ! toolbars || toolbars.length < 2 || ( state === 'hide' && ! toolbars[1].visible() ) ) {
return;
}
if ( ! state && toolbars[1].visible() ) {
state = 'hide';
}
tinymce.each( toolbars, function( toolbar, i ) {
if ( i > 0 ) {
if ( state === 'hide' ) {
toolbar.hide();
pixels += 30;
} else {
toolbar.show();
pixels -= 30;
}
}
});
if ( pixels && ! initial ) {
iframe = editor.getContentAreaContainer().firstChild;
DOM.setStyle( iframe, 'height', iframe.clientHeight + pixels ); // Resize iframe
if ( state === 'hide' ) {
setUserSetting('hidetb', '1');
wpAdvButton && wpAdvButton.active( false );
} else {
setUserSetting('hidetb', '0');
wpAdvButton && wpAdvButton.active( true );
}
}
}
// Add the kitchen sink button :)
editor.addButton( 'wp_adv', {
tooltip: 'Toolbar Toggle',
cmd: 'WP_Adv',
onPostRender: function() {
wpAdvButton = this;
}
});
// Hide the toolbars after loading
editor.on( 'PostRender', function() {
if ( getUserSetting('hidetb', '1') === '1' ) {
toggleToolbars( 'hide' );
}
});
editor.addCommand( 'WP_Adv', function() {
toggleToolbars();
});
editor.on( 'focus', function() {
window.wpActiveEditor = editor.id;
});
// Replace Read More/Next Page tags with images
editor.on( 'BeforeSetContent', function( e ) {
if ( e.content ) {
if ( e.content.indexOf( '<!--more' ) !== -1 ) {
e.content = e.content.replace( /<!--more(.*?)-->/g, function( match, moretext ) {
return '<img src="' + tinymce.Env.transparentSrc + '" data-wp-more="' + moretext + '" ' +
'class="wp-more-tag mce-wp-more" title="Read More..." data-mce-resize="false" data-mce-placeholder="1" />';
});
}
if ( e.content.indexOf( '<!--nextpage-->' ) !== -1 ) {
e.content = e.content.replace( /<!--nextpage-->/g,
'<img src="' + tinymce.Env.transparentSrc + '" class="wp-more-tag mce-wp-nextpage" ' +
'title="Page break" data-mce-resize="false" data-mce-placeholder="1" />' );
}
}
});
// Replace images with tags
editor.on( 'PostProcess', function( e ) {
if ( e.get ) {
e.content = e.content.replace(/<img[^>]+>/g, function( image ) {
var match, moretext = '';
if ( image.indexOf('wp-more-tag') !== -1 ) {
if ( image.indexOf('mce-wp-more') !== -1 ) {
if ( match = image.match( /data-wp-more="([^"]+)"/ ) ) {
moretext = match[1];
}
image = '<!--more' + moretext + '-->';
} else if ( image.indexOf('mce-wp-nextpage') !== -1 ) {
image = '<!--nextpage-->';
}
}
return image;
});
}
});
// Display the tag name instead of img in element path
editor.on( 'ResolveName', function( e ) {
var dom = editor.dom,
target = e.target;
if ( target.nodeName === 'IMG' && dom.hasClass( target, 'wp-more-tag' ) ) {
if ( dom.hasClass( target, 'mce-wp-more' ) ) {
e.name = 'more';
} else if ( dom.hasClass( target, 'mce-wp-nextpage' ) ) {
e.name = 'nextpage';
}
}
});
// Register commands
editor.addCommand( 'WP_More', function( tag ) {
var parent, html, title,
classname = 'wp-more-tag',
dom = editor.dom,
node = editor.selection.getNode();
tag = tag || 'more';
classname += ' mce-wp-' + tag;
title = tag === 'more' ? 'More...' : 'Next Page';
html = '<img src="' + tinymce.Env.transparentSrc + '" title="' + title + '" class="' + classname + '" data-mce-resize="false" data-mce-placeholder="1" />';
if ( node.nodeName === 'BODY' ) {
editor.insertContent( '<p>' + html + '</p>' );
return;
}
// Get the top level parent node
parent = dom.getParent( node, function( found ) {
if ( found.parentNode && found.parentNode.nodeName === 'BODY' ) {
return true;
}
return false;
}, editor.getBody() );
if ( parent ) {
dom.insertAfter( dom.create( 'p', null, html ), parent );
}
});
editor.addCommand( 'WP_Page', function() {
editor.execCommand( 'WP_More', 'nextpage' );
});
editor.addCommand( 'WP_Help', function() {
editor.windowManager.open({
url: tinymce.baseURL + '/wp-mce-help.php',
width: 450,
height: 420,
inline: 1
});
});
editor.addCommand( 'WP_Medialib', function() {
if ( typeof wp !== 'undefined' && wp.media && wp.media.editor ) {
wp.media.editor.open( editor.id );
}
});
// Register buttons
editor.addButton( 'wp_more', {
tooltip: 'Insert Read More tag',
onclick: function() {
editor.execCommand( 'WP_More', 'more' );
}
});
editor.addButton( 'wp_page', {
tooltip: 'Page break',
onclick: function() {
editor.execCommand( 'WP_More', 'nextpage' );
}
});
editor.addButton( 'wp_help', {
tooltip: 'Help',
cmd: 'WP_Help'
});
// Menubar
// Insert->Add Media
if ( typeof wp !== 'undefined' && wp.media && wp.media.editor ) {
editor.addMenuItem( 'add_media', {
text: 'Add Media',
context: 'insert',
cmd: 'WP_Medialib'
});
}
// Insert "Read More..."
editor.addMenuItem( 'wp_more', {
text: 'Insert Read More tag',
context: 'insert',
onclick: function() {
editor.execCommand( 'WP_More', 'more' );
}
});
// Insert "Next Page"
editor.addMenuItem( 'wp_page', {
text: 'Page break',
context: 'insert',
onclick: function() {
editor.execCommand( 'WP_More', 'nextpage' );
}
});
editor.on( 'BeforeExecCommand', function(e) {
if ( tinymce.Env.webkit && ( e.command === 'InsertUnorderedList' || e.command === 'InsertOrderedList' ) ) {
if ( ! style ) {
style = editor.dom.create( 'style', {'type': 'text/css'},
'#tinymce,#tinymce span,#tinymce li,#tinymce li>span,#tinymce p,#tinymce p>span{font:medium sans-serif;color:#000;line-height:normal;}');
}
editor.getDoc().head.appendChild( style );
}
});
editor.on( 'ExecCommand', function( e ) {
if ( tinymce.Env.webkit && style &&
( 'InsertUnorderedList' === e.command || 'InsertOrderedList' === e.command ) ) {
editor.dom.remove( style );
}
});
editor.on( 'init', function() {
var env = tinymce.Env,
bodyClass = ['mceContentBody'], // back-compat for themes that use this in editor-style.css...
body = editor.getBody();
if ( editor.getParam( 'directionality' ) === 'rtl' ) {
bodyClass.push('rtl');
}
if ( env.ie ) {
if ( parseInt( env.ie, 10 ) === 9 ) {
bodyClass.push('ie9');
} else if ( parseInt( env.ie, 10 ) === 8 ) {
bodyClass.push('ie8');
} else if ( env.ie < 8 ) {
bodyClass.push('ie7');
}
}
bodyClass.push('wp-editor');
tinymce.each( bodyClass, function( cls ) {
if ( cls ) {
editor.dom.addClass( body, cls );
}
});
// Remove invalid parent paragraphs when inserting HTML
// TODO: still needed?
editor.on( 'BeforeSetContent', function( e ) {
if ( e.content ) {
e.content = e.content.replace(/<p>\s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)( [^>]*)?>/gi, '<$1$2>');
e.content = e.content.replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)>\s*<\/p>/gi, '</$1>');
}
});
});
// Word count
if ( typeof jQuery !== 'undefined' ) {
editor.on( 'keyup', function( e ) {
var key = e.keyCode || e.charCode;
if ( key === last ) {
return;
}
if ( 13 === key || 8 === last || 46 === last ) {
jQuery(document).triggerHandler( 'wpcountwords', [ editor.getContent({ format : 'raw' }) ] );
}
last = key;
});
}
editor.on( 'SaveContent', function( e ) {
// If editor is hidden, we just want the textarea's value to be saved
if ( editor.isHidden() ) {
e.content = e.element.value;
return;
}
// Keep empty paragraphs :(
e.content = e.content.replace( /<p>(<br ?\/?>|\u00a0|\uFEFF)?<\/p>/g, '<p>&nbsp;</p>' );
if ( editor.getParam( 'wpautop', true ) && typeof switchEditors !== 'undefined' ) {
e.content = switchEditors.pre_wpautop( e.content );
}
});
// Add custom shortcuts
modKey = 'alt+shift';
editor.addShortcut( modKey + '+c', '', 'JustifyCenter' );
editor.addShortcut( modKey + '+r', '', 'JustifyRight' );
editor.addShortcut( modKey + '+l', '', 'JustifyLeft' );
editor.addShortcut( modKey + '+j', '', 'JustifyFull' );
editor.addShortcut( modKey + '+q', '', 'mceBlockQuote' );
editor.addShortcut( modKey + '+u', '', 'InsertUnorderedList' );
editor.addShortcut( modKey + '+o', '', 'InsertOrderedList' );
editor.addShortcut( modKey + '+n', '', 'mceSpellCheck' );
editor.addShortcut( modKey + '+a', '', 'WP_Link' );
editor.addShortcut( modKey + '+s', '', 'unlink' );
editor.addShortcut( modKey + '+m', '', 'WP_Medialib' );
editor.addShortcut( modKey + '+z', '', 'WP_Adv' );
editor.addShortcut( modKey + '+t', '', 'WP_More' );
editor.addShortcut( modKey + '+d', '', 'Strikethrough' );
editor.addShortcut( modKey + '+h', '', 'WP_Help' );
editor.addShortcut( modKey + '+p', '', 'WP_Page' );
editor.addShortcut( 'ctrl+s', '', function() {
if ( typeof autosave === 'function' ) {
autosave();
}
});
// popup buttons for the gallery, etc.
editor.on( 'init', function() {
editor.dom.bind( editor.getWin(), 'scroll', function() {
_hideButtons();
});
editor.dom.bind( editor.getBody(), 'dragstart', function() {
_hideButtons();
});
});
editor.on( 'BeforeExecCommand', function() {
_hideButtons();
});
editor.on( 'SaveContent', function() {
_hideButtons();
});
editor.on( 'MouseDown', function( e ) {
if ( e.target.nodeName !== 'IMG' ) {
_hideButtons();
}
});
editor.on( 'keydown', function( e ) {
if ( e.which === tinymce.util.VK.DELETE || e.which === tinymce.util.VK.BACKSPACE ) {
_hideButtons();
}
});
// Internal functions
function _setEmbed( c ) {
return c.replace( /\[embed\]([\s\S]+?)\[\/embed\][\s\u00a0]*/g, function( a, b ) {
return '<img width="300" height="200" src="' + tinymce.Env.transparentSrc + '" class="wp-oembed" ' +
'alt="'+ b +'" title="'+ b +'" data-mce-resize="false" data-mce-placeholder="1" />';
});
}
function _getEmbed( c ) {
return c.replace( /<img[^>]+>/g, function( a ) {
if ( a.indexOf('class="wp-oembed') !== -1 ) {
var u = a.match( /alt="([^\"]+)"/ );
if ( u[1] ) {
a = '[embed]' + u[1] + '[/embed]';
}
}
return a;
});
}
function _showButtons( n, id ) {
var p1, p2, vp, X, Y;
vp = editor.dom.getViewPort( editor.getWin() );
p1 = DOM.getPos( editor.getContentAreaContainer() );
p2 = editor.dom.getPos( n );
X = Math.max( p2.x - vp.x, 0 ) + p1.x;
Y = Math.max( p2.y - vp.y, 0 ) + p1.y;
DOM.setStyles( id, {
'top' : Y + 5 + 'px',
'left' : X + 5 + 'px',
'display': 'block'
});
}
function _hideButtons() {
DOM.hide( DOM.select( '#wp_editbtns, #wp_gallerybtns' ) );
}
// Expose some functions (back-compat)
return {
_showButtons: _showButtons,
_hideButtons: _hideButtons,
_setEmbed: _setEmbed,
_getEmbed: _getEmbed
};
});

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
!function(){tinymce.create("tinymce.plugins.WPDialogs",{init:function(a){tinymce.create("tinymce.WPWindowManager:tinymce.InlineWindowManager",{WPWindowManager:function(a){this.parent(a)},open:function(a,b){var c,d=this;return a.wpDialog?(a.id&&(c=jQuery("#"+a.id),c.length&&(d.features=a,d.params=b,d.onOpen.dispatch(d,a,b),d.element=d.windows[a.id]=c,d.bookmark=d.editor.selection.getBookmark(1),c.data("wpdialog")||c.wpdialog({title:a.title,width:a.width,height:a.height,modal:!0,dialogClass:"wp-dialog",zIndex:3e5}),c.wpdialog("open"))),void 0):this.parent(a,b)},close:function(){return this.features.wpDialog?(this.element.wpdialog("close"),void 0):this.parent.apply(this,arguments)}}),a.onBeforeRenderUI.add(function(){a.windowManager=new tinymce.WPWindowManager(a)})},getInfo:function(){return{longname:"WPDialogs",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"0.1"}}}),tinymce.PluginManager.add("wpdialogs",tinymce.plugins.WPDialogs)}();

View File

@ -1,71 +0,0 @@
/* global tinymce */
(function() {
tinymce.create('tinymce.plugins.WPDialogs', {
init : function( ed ) {
tinymce.create('tinymce.WPWindowManager:tinymce.InlineWindowManager', {
WPWindowManager : function(ed) {
this.parent(ed);
},
open : function(f, p) {
var t = this, element;
if ( ! f.wpDialog )
return this.parent( f, p );
else if ( ! f.id )
return;
element = jQuery('#' + f.id);
if ( ! element.length )
return;
t.features = f;
t.params = p;
t.onOpen.dispatch(t, f, p);
t.element = t.windows[ f.id ] = element;
// Store selection
t.bookmark = t.editor.selection.getBookmark(1);
// Create the dialog if necessary
if ( ! element.data('wpdialog') ) {
element.wpdialog({
title: f.title,
width: f.width,
height: f.height,
modal: true,
dialogClass: 'wp-dialog',
zIndex: 300000
});
}
element.wpdialog('open');
},
close : function() {
if ( ! this.features.wpDialog )
return this.parent.apply( this, arguments );
this.element.wpdialog('close');
}
});
// Replace window manager
ed.onBeforeRenderUI.add(function() {
ed.windowManager = new tinymce.WPWindowManager(ed);
});
},
getInfo : function() {
return {
longname : 'WPDialogs',
author : 'WordPress',
authorurl : 'http://wordpress.org',
infourl : 'http://wordpress.org',
version : '0.1'
};
}
});
// Register plugin
tinymce.PluginManager.add('wpdialogs', tinymce.plugins.WPDialogs);
})();

View File

@ -1,436 +0,0 @@
/**
* popup.js
*
* An altered version of tinyMCEPopup to work in the same window as tinymce.
*
* ------------------------------------------------------------------
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
// Some global instances
/**
* TinyMCE popup/dialog helper class. This gives you easy access to the
* parent editor instance and a bunch of other things. It's higly recommended
* that you load this script into your dialogs.
*
* @static
* @class tinyMCEPopup
*/
var tinyMCEPopup = {
/**
* Initializes the popup this will be called automatically.
*
* @method init
*/
init : function() {
var t = this, w, ti;
// Find window & API
w = t.getWin();
tinymce = w.tinymce;
tinyMCE = w.tinyMCE;
t.editor = tinymce.EditorManager.activeEditor;
t.params = t.editor.windowManager.params;
t.features = t.editor.windowManager.features;
t.dom = tinymce.dom;
// Setup on init listeners
t.listeners = [];
t.onInit = {
add : function(f, s) {
t.listeners.push({func : f, scope : s});
}
};
t.isWindow = false;
t.id = t.features.id;
t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
},
/**
* Returns the reference to the parent window that opened the dialog.
*
* @method getWin
* @return {Window} Reference to the parent window that opened the dialog.
*/
getWin : function() {
return window;
},
/**
* Returns a window argument/parameter by name.
*
* @method getWindowArg
* @param {String} n Name of the window argument to retrieve.
* @param {String} dv Optional default value to return.
* @return {String} Argument value or default value if it wasn't found.
*/
getWindowArg : function(n, dv) {
var v = this.params[n];
return tinymce.is(v) ? v : dv;
},
/**
* Returns a editor parameter/config option value.
*
* @method getParam
* @param {String} n Name of the editor config option to retrieve.
* @param {String} dv Optional default value to return.
* @return {String} Parameter value or default value if it wasn't found.
*/
getParam : function(n, dv) {
return this.editor.getParam(n, dv);
},
/**
* Returns a language item by key.
*
* @method getLang
* @param {String} n Language item like mydialog.something.
* @param {String} dv Optional default value to return.
* @return {String} Language value for the item like "my string" or the default value if it wasn't found.
*/
getLang : function(n, dv) {
return this.editor.getLang(n, dv);
},
/**
* Executed a command on editor that opened the dialog/popup.
*
* @method execCommand
* @param {String} cmd Command to execute.
* @param {Boolean} ui Optional boolean value if the UI for the command should be presented or not.
* @param {Object} val Optional value to pass with the comman like an URL.
* @param {Object} a Optional arguments object.
*/
execCommand : function(cmd, ui, val, a) {
a = a || {};
a.skip_focus = 1;
this.restoreSelection();
return this.editor.execCommand(cmd, ui, val, a);
},
/**
* Resizes the dialog to the inner size of the window. This is needed since various browsers
* have different border sizes on windows.
*
* @method resizeToInnerSize
*/
resizeToInnerSize : function() {
var t = this;
// Detach it to workaround a Chrome specific bug
// https://sourceforge.net/tracker/?func=detail&atid=635682&aid=2926339&group_id=103281
setTimeout(function() {
var vp = t.dom.getViewPort(window);
t.editor.windowManager.resizeBy(
t.getWindowArg('mce_width') - vp.w,
t.getWindowArg('mce_height') - vp.h,
t.id || window
);
}, 0);
},
/**
* Will executed the specified string when the page has been loaded. This function
* was added for compatibility with the 2.x branch.
*
* @method executeOnLoad
* @param {String} s String to evalutate on init.
*/
executeOnLoad : function(s) {
this.onInit.add(function() {
eval(s);
});
},
/**
* Stores the current editor selection for later restoration. This can be useful since some browsers
* loses its selection if a control element is selected/focused inside the dialogs.
*
* @method storeSelection
*/
storeSelection : function() {
this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark(1);
},
/**
* Restores any stored selection. This can be useful since some browsers
* loses its selection if a control element is selected/focused inside the dialogs.
*
* @method restoreSelection
*/
restoreSelection : function() {
var t = tinyMCEPopup;
if (!t.isWindow && tinymce.isIE) {
t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
}
},
/**
* Loads a specific dialog language pack. If you pass in plugin_url as a arugment
* when you open the window it will load the <plugin url>/langs/<code>_dlg.js lang pack file.
*
* @method requireLangPack
*/
requireLangPack : function() {
var t = this, u = t.getWindowArg('plugin_url') || t.getWindowArg('theme_url');
if (u && t.editor.settings.language && t.features.translate_i18n !== false) {
u += '/langs/' + t.editor.settings.language + '_dlg.js';
if (!tinymce.ScriptLoader.isDone(u)) {
document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"></script>');
tinymce.ScriptLoader.markDone(u);
}
}
},
/**
* Executes a color picker on the specified element id. When the user
* then selects a color it will be set as the value of the specified element.
*
* @method pickColor
* @param {DOMEvent} e DOM event object.
* @param {string} element_id Element id to be filled with the color value from the picker.
*/
pickColor : function(e, element_id) {
this.execCommand('mceColorPicker', true, {
color : document.getElementById(element_id).value,
func : function(c) {
document.getElementById(element_id).value = c;
try {
document.getElementById(element_id).onchange();
} catch (ex) {
// Try fire event, ignore errors
}
}
});
},
/**
* Opens a filebrowser/imagebrowser this will set the output value from
* the browser as a value on the specified element.
*
* @method openBrowser
* @param {string} element_id Id of the element to set value in.
* @param {string} type Type of browser to open image/file/flash.
* @param {string} option Option name to get the file_broswer_callback function name from.
*/
openBrowser : function(element_id, type, option) {
tinyMCEPopup.restoreSelection();
this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window);
},
/**
* Creates a confirm dialog. Please don't use the blocking behavior of this
* native version use the callback method instead then it can be extended.
*
* @method confirm
* @param {String} t Title for the new confirm dialog.
* @param {function} cb Callback function to be executed after the user has selected ok or cancel.
* @param {Object} s Optional scope to execute the callback in.
*/
confirm : function(t, cb, s) {
this.editor.windowManager.confirm(t, cb, s, window);
},
/**
* Creates an alert dialog. Please don't use the blocking behavior of this
* native version use the callback method instead then it can be extended.
*
* @method alert
* @param {String} t Title for the new alert dialog.
* @param {function} cb Callback function to be executed after the user has selected ok.
* @param {Object} s Optional scope to execute the callback in.
*/
alert : function(tx, cb, s) {
this.editor.windowManager.alert(tx, cb, s, window);
},
/**
* Closes the current window.
*
* @method close
*/
close : function() {
var t = this;
// To avoid domain relaxing issue in Opera
function close() {
t.editor.windowManager.close(window);
t.editor = null;
};
if (tinymce.isOpera)
t.getWin().setTimeout(close, 0);
else
close();
},
// Internal functions
_restoreSelection : function(e) {
var el = e && e.target ? e.target : window.event.srcElement;
if ( el.nodeName == 'INPUT' && ( el.type == 'submit' || el.type == 'button' ) ) {
tinyMCEPopup.restoreSelection();
}
},
/* _restoreSelection : function() {
var e = window.event.srcElement;
// If user focus a non text input or textarea
if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text')
tinyMCEPopup.restoreSelection();
},*/
_onDOMLoaded : function() {
var t = tinyMCEPopup, ti = document.title, bm, h, nv;
if (t.domLoaded)
return;
t.domLoaded = 1;
tinyMCEPopup.init();
// Translate page
if (t.features.translate_i18n !== false) {
h = document.body.innerHTML;
// Replace a=x with a="x" in IE
if (tinymce.isIE)
h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"')
document.dir = t.editor.getParam('directionality','');
if ((nv = t.editor.translate(h)) && nv != h)
document.body.innerHTML = nv;
if ((nv = t.editor.translate(ti)) && nv != ti)
document.title = ti = nv;
}
document.body.style.display = '';
// Restore selection in IE when focus is placed on a non textarea or input element of the type text
if ( tinymce.isIE && ! tinymce.isIE11 ) {
document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection);
// Add base target element for it since it would fail with modal dialogs
t.dom.add(t.dom.select('head')[0], 'base', {target : '_self'});
} else if ( tinymce.isIE11 ) {
document.addEventListener('mouseup', tinyMCEPopup._restoreSelection, false);
}
t.restoreSelection();
// Set inline title
if (!t.isWindow)
t.editor.windowManager.setTitle(window, ti);
else
window.focus();
if (!tinymce.isIE && !t.isWindow) {
tinymce.dom.Event._add(document, 'focus', function() {
t.editor.windowManager.focus(t.id);
});
}
// Patch for accessibility
tinymce.each(t.dom.select('select'), function(e) {
e.onkeydown = tinyMCEPopup._accessHandler;
});
// Call onInit
// Init must be called before focus so the selection won't get lost by the focus call
tinymce.each(t.listeners, function(o) {
o.func.call(o.scope, t.editor);
});
// Move focus to window
if (t.getWindowArg('mce_auto_focus', true)) {
window.focus();
// Focus element with mceFocus class
tinymce.each(document.forms, function(f) {
tinymce.each(f.elements, function(e) {
if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) {
e.focus();
return false; // Break loop
}
});
});
}
document.onkeyup = tinyMCEPopup._closeWinKeyHandler;
},
_accessHandler : function(e) {
e = e || window.event;
if (e.keyCode == 13 || e.keyCode == 32) {
e = e.target || e.srcElement;
if (e.onchange)
e.onchange();
return tinymce.dom.Event.cancel(e);
}
},
_closeWinKeyHandler : function(e) {
e = e || window.event;
if (e.keyCode == 27)
tinyMCEPopup.close();
},
_wait : function() {
// Use IE method
if (document.attachEvent) {
document.attachEvent("onreadystatechange", function() {
if (document.readyState === "complete") {
document.detachEvent("onreadystatechange", arguments.callee);
tinyMCEPopup._onDOMLoaded();
}
});
if (document.documentElement.doScroll && window == window.top) {
(function() {
if (tinyMCEPopup.domLoaded)
return;
try {
// If IE is used, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
document.documentElement.doScroll("left");
} catch (ex) {
setTimeout(arguments.callee, 0);
return;
}
tinyMCEPopup._onDOMLoaded();
})();
}
document.attachEvent('onload', tinyMCEPopup._onDOMLoaded);
} else if (document.addEventListener) {
window.addEventListener('DOMContentLoaded', tinyMCEPopup._onDOMLoaded, false);
window.addEventListener('load', tinyMCEPopup._onDOMLoaded, false);
}
}
};

Some files were not shown because too many files have changed in this diff Show More