Task #2764 - insertHtml plugin: A shallow visual correction, it seems good enougn to me.

skala
Ivan Tcholakov 15 years ago
parent 27a8fa868c
commit 00c13670cf
  1. 2
      main/inc/lib/fckeditor/editor/plugins/insertHtml/fckplugin.js
  2. 42
      main/inc/lib/fckeditor/editor/plugins/insertHtml/insertHtml.js
  3. 17
      main/inc/lib/fckeditor/myconfig.php

@ -33,7 +33,7 @@
{
if (FCKConfig.insertHtml_showDialog || !FCKConfig.insertHtml_snippets || (FCKConfig.insertHtml_snippets && !FCKConfig.insertHtml_snippets.length))
{
var dialog = new FCKDialogCommand('insertHtml', FCKLang.insertHtml_dialogTitle, FCKPlugins.Items['insertHtml'].Path + 'insertHtml.html', 200, 100);
var dialog = new FCKDialogCommand('insertHtml', FCKLang.insertHtml_dialogTitle, FCKPlugins.Items['insertHtml'].Path + 'insertHtml.html', FCKConfig.insertHtml_dialogWidth || 475, FCKConfig.insertHtml_dialogHeight || 475);
dialog.Execute();
}
else

@ -13,7 +13,7 @@
{
var description, snippet;
// show snippets to choose from
// Show snippets to choose from
if (typeof(FCKConfig.insertHtml_snippets) == 'object')
{
var snippetsDiv, snippetDiv, numberOfSnippets = 0;
@ -49,19 +49,19 @@
}
document.getElementById('content').appendChild(snippetsDiv);
// load dialog
// Load the dialog
}
// show textarea
// Show the textarea
if (FCKConfig.insertHtml_showTextarea || !FCKConfig.insertHtml_snippets || !numberOfSnippets)
{
insertHtmlTextArea = document.createElement('textarea');
insertHtmlTextArea.id = 'insertHtmlTextArea';
document.getElementById('content').appendChild(insertHtmlTextArea);
// set the size of the textarea
insertHtmlTextArea.style.width = (FCKConfig.insertHtml_textareaWidth || 300) + 'px';
insertHtmlTextArea.style.height = (FCKConfig.insertHtml_textareaHeight || 100) + 'px';
// load default content
// Set the size of the textarea
insertHtmlTextArea.style.width = (FCKConfig.insertHtml_textareaWidth || 400) + 'px';
insertHtmlTextArea.style.height = (FCKConfig.insertHtml_textareaHeight || 300) + 'px';
// Load default content
if (typeof(FCKConfig.insertHtml_snippets) == 'object')
{
for (description in FCKConfig.insertHtml_snippets)
@ -73,31 +73,31 @@
else
{
//snippet = FCKConfig.insertHtml_snippets;//Chamilo replaced by below (by now)
snippet = "";//Insert your tex here
snippet = ''; // Insert your text here
}
insertHtmlTextArea.value = snippet;
}
// resize around snippets and/or textarea
// for IE this must be done before translating the dialog or the dialog will be to wide; also IE needs an approximate resize before autofitting or the dialog width will be to large
if (FCKBrowserInfo.IsIE) dialog.Sizer.ResizeDialog(parseInt(FCKConfig.insertHtml_textareaWidth || 300), parseInt(FCKConfig.insertHtml_textareaHeight || 100) + 130);
// Resize around snippets and/or textarea
// For IE this must be done before translating the dialog or the dialog will be to wide; also IE needs an approximate resize before autofitting or the dialog width will be to large
//if (FCKBrowserInfo.IsIE) dialog.Sizer.ResizeDialog(parseInt(FCKConfig.insertHtml_textareaWidth || 400), parseInt(FCKConfig.insertHtml_textareaHeight || 300) + 130);
dialog.SetAutoSize(true);
// recenter dialog
setTimeout(function(){ // after a dummy delay, needed for webkit
var topWindowSize = FCKTools.GetViewPaneSize(dialog.top.window);
dialog.frameElement.style.left = Math.round((topWindowSize.Width - dialog.frameElement.offsetWidth) / 2) + 'px';
dialog.frameElement.style.top = Math.round((topWindowSize.Height - dialog.frameElement.offsetHeight) / 2).toString() + 'px';;
}, 0);
// Recenter the dialog
//setTimeout(function(){ // after a dummy delay, needed for webkit
// var topWindowSize = FCKTools.GetViewPaneSize(dialog.top.window);
// dialog.frameElement.style.left = Math.round((topWindowSize.Width - dialog.frameElement.offsetWidth) / 2) + 'px';
// dialog.frameElement.style.top = Math.round((topWindowSize.Height - dialog.frameElement.offsetHeight) / 2).toString() + 'px';;
//}, 0);
// translate the dialog box texts
// Translate the dialog box texts
editorWindow.FCKLanguageManager.TranslatePage(document);
// activate the "OK" button
// Activate the "OK" button
dialog.SetOkButton(true);
}
// dialog's 'ok' button function to insert the Html
// Dialog's 'ok' button function to insert the Html
function Ok()
{
if (insertHtmlTextArea.value)
@ -105,7 +105,7 @@
editorInstance.InsertHtml(insertHtmlTextArea.value);
editorWindow.FCKUndo.SaveUndoStep();
return true; // makes the dialog to close
return true; // Makes the dialog to close
}
}

@ -235,24 +235,29 @@ $config['LoadPlugin'][] = 'wikilink';
// insertHtml: Plugin for inserting HTML. A single preconfigured snippet; a choice from multiple preconfigured snippets; or manually entered HTML.
if ((api_get_setting('enabled_insertHtml') == 'true')) {
$config['LoadPlugin'][] = 'insertHtml';
}
// enter a single snippet (HMTL string) or multiple snippets to choose form (object of description string and HTML string pairs). Or leave empty if you want to show a dialog for the user to enter HTML manually (and not show any default HTML in the dialog textarea)
// Enter a single snippet (HMTL string) or multiple snippets to choose form (object of description string and HTML string pairs). Or leave empty if you want to show a dialog for the user to enter HTML manually (and not show any default HTML in the dialog textarea)
//$config['insertHtml_snippets'] = { 'ArtGallery': '<embed width="475" height="400" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="FlashGallery/Art/ArtFlashGallery.swf" mediaType="flashGallery" bgcolor="#ffffff" allowfullscreen="true" flashvars="XMLFile=userfiles/image/ArtGallery/gallery.xml"></embed>', 'PhotoFlowGallery' : '<embed width="700" height="300" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="FlashGallery/PhotoFlow/PhotoFlowGallery.swf" mediaType="flashGallery" bgcolor="#ffffff" flashvars="XMLFile=userfiles/image/PhotoFlowGallery/gallery.xml"></embed>', 'StackPhotoGallery' : '<embed width="600" height="400" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="FlashGallery/StackPhoto/StackPhotoGallery.swf" mediaType="flashGallery" bgcolor="#ffffff" flashvars="XMLFile=userfiles/image/StackPhotoGallery/gallery.xml"></embed>', 'ZenGallery' : '<embed width="550" height="400" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="FlashGallery/Zen/ZenGallery.swf" mediaType="flashGallery" bgcolor="#ffffff" flashvars="XMLFile=userfiles/image/ZenGallery/gallery.xml"></embed>'};// TODO: this $config['insertHtml_snippets'] does not work. See also temporal hack around line 76 insertHtml.js
// (if no snippets specified the dialog will show anyhow)
// (If no snippets are specified the dialog will show up anyhow)
$config['insertHtml_showDialog'] = true;
// specify a custom tooltip if you want this to appear when hovering the plugin's toolbar button (e.g. a description of the element being inserted). If no custom tooltip is set 'Insert HTML' will appear, and if available, translated into your language
// Specify a custom tooltip if you want this to appear when hovering the plugin's toolbar button (e.g. a description of the element being inserted). If no custom tooltip is set 'Insert HTML' will appear, and if available, translated into your language
$config['insertHtml_buttonTooltip'] = '';
// show a textarea in the dialog? The first HTML set with $config['insertHtml_snippets'] will be shown in the textarea by default. If no snippets specified the textarea will show anyhow
// Show a textarea in the dialog? The first HTML set with $config['insertHtml_snippets'] will be shown in the textarea by default. If no snippets specified the textarea will show anyhow
$config['insertHtml_showTextarea']= false;
// the size of the textarea in the dialog, in px
// The size of the textarea in the dialog, in px
$config['insertHtml_textareaWidth'] = 400;
$config['insertHtml_textareaHeight'] = 300;
// The size of the the dialog, in px
$config['insertHtml_dialogWidth'] = 475;
$config['insertHtml_dialogHeight'] = 475;
}
/*
* File manager.
*/

Loading…
Cancel
Save