mirror of
https://github.com/UnickSoft/graphonline.git
synced 2026-04-22 16:09:58 +00:00
first commit
This commit is contained in:
68
lib/ckeditor4/plugins/backgrounds/docs/install.html
Executable file
68
lib/ckeditor4/plugins/backgrounds/docs/install.html
Executable file
@@ -0,0 +1,68 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Backgrounds plugin</title>
|
||||
<link href="styles.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Backgrounds Plugin for CKEditor</h1>
|
||||
|
||||
<h2>Introduction</h2>
|
||||
<p>This is a plugin that creates a field to set a background image for tables and cells in <a href="http://www.ckeditor.com">CKEditor</a>.</p>
|
||||
<p>No new dialogs, commands or toolbar buttons are added, the fields are placed in the advanced tab of the Table dialog and the bottom of the Cell Properties dialog.</p>
|
||||
|
||||
<h3 id="contact">Author:</h3>
|
||||
<p><a href="mailto:amla70@gmail.com">Alfonso Martínez de Lizarrondo</a></p>
|
||||
<h3>Sponsored by:</h3>
|
||||
<p><a href="http://www.igenti.com">Igenti, Inc.</a></p>
|
||||
<h3>Version history: </h3>
|
||||
<ol>
|
||||
<li>1.0: 11-January-2011. First version.</li>
|
||||
<li>1.1: 16-January-2011. Added localization for the field label <a href="http://alfonsoml.blogspot.com/2011/01/avoiding-extra-request-for-translation.html">without extra requests</a>.</li>
|
||||
<li>1.2: 19-March-2013. Compatibility with CKEditor 4 (translation) and an attempt to integrate with the upcoming ACF in 4.1.</li>
|
||||
<li>1.3: 26-March-2013. Improved integration with ACF.</li>
|
||||
<li>1.3.1: 19-July-2013. Protection in case one of the tabs have been removed. Thanks to Farhan.</li>
|
||||
</ol>
|
||||
<p>Check for latest version and other <a href="http://alfonsoml.blogspot.com">CKEditor plugins</a></p>
|
||||
|
||||
<h2>Installation</h2>
|
||||
<h3>1. Copying the files</h3>
|
||||
<p>Extract the contents of the zip in you plugins directory, so it ends up like
|
||||
this<br>
|
||||
<!--<img src="installation.png" alt="Screenshot of installation" width="311" height="346" longdesc="#install">-->
|
||||
</p>
|
||||
<pre id="--install">
|
||||
ckeditor\
|
||||
...
|
||||
images\
|
||||
lang\
|
||||
plugins\
|
||||
...
|
||||
backgrounds\
|
||||
plugin.js
|
||||
readme.html
|
||||
docs\
|
||||
...
|
||||
skins\
|
||||
themes\
|
||||
</pre>
|
||||
<h3>2. Adding it to CKEditor</h3>
|
||||
<p>Now add the plugin in your <em>config.js</em> or custom js configuration
|
||||
file:
|
||||
<code>config.extraPlugins='backgrounds'; </code>
|
||||
</p>
|
||||
|
||||
<h3>3. Use it</h3>
|
||||
<p align="right">Now empty the cache of your browser and reload the editor, field will show up in the Table an Cell dialogs.
|
||||
If you have enabled the file browser (for the images dialog for example) then the Browse server button will show up.</p>
|
||||
<!--
|
||||
<h2>Final notes</h2>
|
||||
-->
|
||||
|
||||
<h2>Disclaimers</h2>
|
||||
<p>CKEditor is © CKSource.com</p>
|
||||
</body>
|
||||
</html>
|
||||
59
lib/ckeditor4/plugins/backgrounds/docs/styles.css
Executable file
59
lib/ckeditor4/plugins/backgrounds/docs/styles.css
Executable file
@@ -0,0 +1,59 @@
|
||||
body {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 90%;
|
||||
}
|
||||
h1 {
|
||||
text-align:center;
|
||||
font-size:180%;
|
||||
}
|
||||
h2 {
|
||||
border-bottom:2px solid #CCC;
|
||||
margin:1em 0 0.4em 0;
|
||||
}
|
||||
h3 {
|
||||
margin-bottom:0.4em;
|
||||
}
|
||||
p {
|
||||
margin:0 0 1em 1em;
|
||||
text-align:justify;
|
||||
}
|
||||
ol {
|
||||
margin:0 0 1.2em 1em;
|
||||
padding:0;
|
||||
list-style-type:none;
|
||||
}
|
||||
ol li {
|
||||
margin:0.2em 0;
|
||||
}
|
||||
pre, code {
|
||||
font-size:100%;
|
||||
font-family:"Courier New", Courier, mono;
|
||||
background-color: #CCCCCC;
|
||||
border:1px solid #999;
|
||||
padding:0.2em 1em;
|
||||
margin: 0.4em 0;
|
||||
display:block;
|
||||
white-space: pre;
|
||||
overflow: auto;
|
||||
}
|
||||
form {
|
||||
margin:0 0 0 1em;
|
||||
}
|
||||
span.key {
|
||||
color: #006600;
|
||||
}
|
||||
#install {
|
||||
display:none
|
||||
}
|
||||
#languages ul {
|
||||
display:inline;
|
||||
list-style-type:none;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
#languages li {
|
||||
display:inline;
|
||||
margin:0;
|
||||
padding:0;
|
||||
vertical-align:bottom;
|
||||
}
|
||||
153
lib/ckeditor4/plugins/backgrounds/plugin.js
Executable file
153
lib/ckeditor4/plugins/backgrounds/plugin.js
Executable file
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* @file Background plugin for CKEditor
|
||||
* Copyright (C) 2011-13 Alfonso Mart<72>nez de Lizarrondo
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
*/
|
||||
|
||||
// A placeholder just to notify that the plugin has been loaded
|
||||
CKEDITOR.plugins.add( 'backgrounds',
|
||||
{
|
||||
// Translations, available at the end of this file, without extra requests
|
||||
// lang : [ 'en', 'es' ],
|
||||
|
||||
init : function( editor )
|
||||
{
|
||||
// v 4.1 filters
|
||||
if (editor.addFeature)
|
||||
{
|
||||
editor.addFeature( {
|
||||
name : 'background image',
|
||||
allowedContent: {
|
||||
'table td th': {
|
||||
propertiesOnly: true,
|
||||
attributes :'background'
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
// It doesn't add commands, buttons or dialogs, it doesn't do anything here
|
||||
} //Init
|
||||
} );
|
||||
|
||||
|
||||
// This is the real code of the plugin
|
||||
CKEDITOR.on( 'dialogDefinition', function( ev )
|
||||
{
|
||||
// Take the dialog name and its definition from the event data.
|
||||
var dialogName = ev.data.name,
|
||||
dialogDefinition = ev.data.definition,
|
||||
editor = ev.editor,
|
||||
tabName = '';
|
||||
|
||||
// Check if it's one of the dialogs that we want to modify and note the proper tab name.
|
||||
if ( dialogName == 'table' || dialogName == 'tableProperties' )
|
||||
tabName = 'advanced';
|
||||
|
||||
if ( dialogName == 'cellProperties' )
|
||||
tabName = 'info';
|
||||
|
||||
// Not one of the managed dialogs.
|
||||
if ( tabName == '' )
|
||||
return;
|
||||
|
||||
// Get a reference to the tab.
|
||||
var tab = dialogDefinition.getContents( tabName );
|
||||
if (!tab)
|
||||
return;
|
||||
|
||||
// The text field
|
||||
var textInput = {
|
||||
type : 'text',
|
||||
label : editor.lang.backgrounds.label,
|
||||
id : 'background',
|
||||
setup : function( selectedElement )
|
||||
{
|
||||
this.setValue( selectedElement.getAttribute( 'background' ) );
|
||||
},
|
||||
commit : function( data, selectedElement )
|
||||
{
|
||||
var element = selectedElement || data,
|
||||
value = this.getValue();
|
||||
if ( value )
|
||||
element.setAttribute( 'background', value );
|
||||
else
|
||||
element.removeAttribute( 'background' );
|
||||
}
|
||||
};
|
||||
|
||||
// Enabled/disabled automatically in 4.1 by ACF
|
||||
if ( dialogName == 'cellProperties' )
|
||||
{
|
||||
textInput.requiredContent = 'td[background];th[background]';
|
||||
}
|
||||
else
|
||||
textInput.requiredContent = 'table[background]';
|
||||
|
||||
// File browser button
|
||||
var browseButton = {
|
||||
type : 'button',
|
||||
id : 'browse',
|
||||
hidden : 'true',
|
||||
filebrowser :
|
||||
{
|
||||
action : 'Browse',
|
||||
target: tabName + ':background',
|
||||
url: editor.config.filebrowserImageBrowseUrl || editor.config.filebrowserBrowseUrl
|
||||
},
|
||||
label : editor.lang.common.browseServer,
|
||||
requiredContent : textInput.requiredContent
|
||||
};
|
||||
|
||||
// Add the elements to the dialog
|
||||
if ( tabName == 'advanced')
|
||||
{
|
||||
// Two rows
|
||||
tab.add(textInput);
|
||||
tab.add(browseButton);
|
||||
}
|
||||
else
|
||||
{
|
||||
// In the cell dialog add it as a single row
|
||||
browseButton.style = 'display:inline-block;margin-top:10px;';
|
||||
tab.add({
|
||||
type : 'hbox',
|
||||
widths: [ '', '100px'],
|
||||
children : [ textInput, browseButton],
|
||||
requiredContent : textInput.requiredContent
|
||||
});
|
||||
}
|
||||
|
||||
// inject this listener before the one from the fileBrowser plugin so there are no problems with the new fields.
|
||||
}, null, null, 9 );
|
||||
|
||||
|
||||
// Translations for the label
|
||||
if (CKEDITOR.skins)
|
||||
{
|
||||
// V3
|
||||
CKEDITOR.plugins.setLang( 'backgrounds', 'en', { backgrounds : { label : 'Background image'} } );
|
||||
CKEDITOR.plugins.setLang( 'backgrounds', 'es', { backgrounds : { label : 'Imagen de fondo' } } );
|
||||
}
|
||||
else
|
||||
{
|
||||
// V4
|
||||
CKEDITOR.plugins.setLang( 'backgrounds', 'en', {label : 'Background image'} );
|
||||
CKEDITOR.plugins.setLang( 'backgrounds', 'es', {label : 'Imagen de fondo'} );
|
||||
}
|
||||
Reference in New Issue
Block a user