activeadmin-ckeditor 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.DS_Store +0 -0
- data/app/.DS_Store +0 -0
- data/app/assets/.DS_Store +0 -0
- data/app/assets/javascripts/.DS_Store +0 -0
- data/app/assets/javascripts/ckeditor/config.js +118 -0
- data/app/assets/stylesheets/.DS_Store +0 -0
- data/app/assets/stylesheets/activeadmin-ckeditor.css.sass +3 -0
- data/app/assets/stylesheets/ckeditor/.DS_Store +0 -0
- data/app/assets/stylesheets/ckeditor/plugins/.DS_Store +0 -0
- data/app/assets/stylesheets/ckeditor/plugins/autogrow/plugin.js +187 -0
- data/app/assets/stylesheets/ckeditor/plugins/autogrow/samples/autogrow.html +99 -0
- data/app/assets/stylesheets/ckeditor/plugins/floating-tools/README.md +20 -0
- data/app/assets/stylesheets/ckeditor/plugins/floating-tools/plugin.js +582 -0
- data/app/assets/stylesheets/ckeditor/plugins/imagepaste/docs/install.html +64 -0
- data/app/assets/stylesheets/ckeditor/plugins/imagepaste/docs/styles.css +59 -0
- data/app/assets/stylesheets/ckeditor/plugins/imagepaste/plugin.js +82 -0
- data/app/assets/stylesheets/ckeditor/plugins/stylesheetparser/plugin.js +152 -0
- data/app/assets/stylesheets/ckeditor/plugins/stylesheetparser/samples/assets/sample.css +70 -0
- data/app/assets/stylesheets/ckeditor/plugins/stylesheetparser/samples/stylesheetparser.html +82 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/LICENSE.md +28 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/README.md +55 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/images/transformCapitalize.png +0 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/images/transformSwitcher.png +0 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/images/transformToLower.png +0 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/images/transformToUpper.png +0 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/lang/en.js +17 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/lang/tr.js +41 -0
- data/app/assets/stylesheets/ckeditor/plugins/texttransform/plugin.js +151 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/images/icon.png +0 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/de.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/en.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/fr.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/hu.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/it.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/ja.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/pt.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/ru.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/lang/tr.js +21 -0
- data/app/assets/stylesheets/ckeditor/plugins/youtube/plugin.js +321 -0
- data/app/assets/stylesheets/ckeditor/skins/.DS_Store +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dev/icons16.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dev/icons16.svg +2106 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dev/icons32.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dev/icons32.svg +2442 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dev/locations.json +139 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dialog.css.scss +7 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dialog_ie.css.scss +7 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dialog_ie7.css.scss +7 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dialog_ie8.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dialog_iequirks.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/dialog_opera.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/editor.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/editor_gecko.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/editor_ie.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/editor_ie7.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/editor_ie8.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/editor_iequirks.css.scss +8 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/arrow.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/close.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/hidpi/close.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/hidpi/lock-open.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/hidpi/lock.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/hidpi/refresh.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/lock-open.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/lock.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/images/refresh.png +0 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/readme.md +51 -0
- data/app/assets/stylesheets/ckeditor/skins/moono/skin.js +10 -0
- data/lib/.DS_Store +0 -0
- data/lib/activeadmin-ckeditor.rb +3 -3
- data/lib/activeadmin-ckeditor/engine.rb +9 -0
- data/lib/activeadmin-ckeditor/version.rb +1 -1
- data/lib/generators/.DS_Store +0 -0
- data/lib/generators/activeadmin/.DS_Store +0 -0
- data/lib/generators/activeadmin/ckeditor/install_generator.rb +19 -0
- metadata +74 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/html4/loose.dtd">
|
|
3
|
+
<html lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
6
|
+
<title>Image paste plugin</title>
|
|
7
|
+
<link href="styles.css" rel="stylesheet" type="text/css">
|
|
8
|
+
</head>
|
|
9
|
+
|
|
10
|
+
<body>
|
|
11
|
+
<h1>Image paste Plugin for CKEditor</h1>
|
|
12
|
+
|
|
13
|
+
<h2>Introduction</h2>
|
|
14
|
+
<p>This is a plugin that automatically uploads to the server the images pasted from the clipboard with Firefox in <a href="http://www.ckeditor.com">CKEditor</a>.</p>
|
|
15
|
+
|
|
16
|
+
<h3 id="contact">Author:</h3>
|
|
17
|
+
<p><a href="mailto:amla70@gmail.com">Alfonso Martínez de Lizarrondo</a></p>
|
|
18
|
+
|
|
19
|
+
<h3>Version history: </h3>
|
|
20
|
+
<ol>
|
|
21
|
+
<li>1.0: 28-September-2011. First public version.</li>
|
|
22
|
+
</ol>
|
|
23
|
+
|
|
24
|
+
<h2>Installation</h2>
|
|
25
|
+
<h3>1. Copying the files</h3>
|
|
26
|
+
<p>Extract the contents of the zip in you plugins directory, so it ends up like
|
|
27
|
+
this<br>
|
|
28
|
+
<!--<img src="installation.png" alt="Screenshot of installation" width="311" height="346" longdesc="#install">-->
|
|
29
|
+
</p>
|
|
30
|
+
<pre id="--install">
|
|
31
|
+
ckeditor\
|
|
32
|
+
...
|
|
33
|
+
images\
|
|
34
|
+
lang\
|
|
35
|
+
plugins\
|
|
36
|
+
...
|
|
37
|
+
imagepaste\
|
|
38
|
+
plugin.js
|
|
39
|
+
docs\
|
|
40
|
+
install.html
|
|
41
|
+
...
|
|
42
|
+
skins\
|
|
43
|
+
themes\
|
|
44
|
+
</pre>
|
|
45
|
+
<h3>2. Adding it to CKEditor</h3>
|
|
46
|
+
<p>Now add the plugin in your <em>config.js</em> or custom js configuration
|
|
47
|
+
file:
|
|
48
|
+
<code>config.extraPlugins='imagepaste'; </code>
|
|
49
|
+
</p>
|
|
50
|
+
|
|
51
|
+
<h3>3. Configuration</h3>
|
|
52
|
+
<p>You have to configure the filebrowserImageUploadUrl entry as you might have already done to allow the user to upload images.</p>
|
|
53
|
+
|
|
54
|
+
<h3>4. Use it</h3>
|
|
55
|
+
<p>Using Firefox, paste an image into the body of CKEditor. That image will be uploaded to the server and it will use the correct URL instead of "data:".</p>
|
|
56
|
+
|
|
57
|
+
<!--
|
|
58
|
+
<h2>Final notes</h2>
|
|
59
|
+
-->
|
|
60
|
+
|
|
61
|
+
<h2>Disclaimers</h2>
|
|
62
|
+
<p>CKEditor is © CKSource.com</p>
|
|
63
|
+
</body>
|
|
64
|
+
</html>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
body {
|
|
2
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
3
|
+
font-size: 90%;
|
|
4
|
+
}
|
|
5
|
+
h1 {
|
|
6
|
+
text-align:center;
|
|
7
|
+
font-size:180%;
|
|
8
|
+
}
|
|
9
|
+
h2 {
|
|
10
|
+
border-bottom:2px solid #CCC;
|
|
11
|
+
margin:1em 0 0.4em 0;
|
|
12
|
+
}
|
|
13
|
+
h3 {
|
|
14
|
+
margin-bottom:0.4em;
|
|
15
|
+
}
|
|
16
|
+
p {
|
|
17
|
+
margin:0 0 1em 1em;
|
|
18
|
+
text-align:justify;
|
|
19
|
+
}
|
|
20
|
+
ol {
|
|
21
|
+
margin:0 0 1.2em 1em;
|
|
22
|
+
padding:0;
|
|
23
|
+
list-style-type:none;
|
|
24
|
+
}
|
|
25
|
+
ol li {
|
|
26
|
+
margin:0.2em 0;
|
|
27
|
+
}
|
|
28
|
+
pre, code {
|
|
29
|
+
font-size:100%;
|
|
30
|
+
font-family:"Courier New", Courier, mono;
|
|
31
|
+
background-color: #CCCCCC;
|
|
32
|
+
border:1px solid #999;
|
|
33
|
+
padding:0.2em 1em;
|
|
34
|
+
margin: 0.4em 0;
|
|
35
|
+
display:block;
|
|
36
|
+
white-space: pre;
|
|
37
|
+
overflow: auto;
|
|
38
|
+
}
|
|
39
|
+
form {
|
|
40
|
+
margin:0 0 0 1em;
|
|
41
|
+
}
|
|
42
|
+
span.key {
|
|
43
|
+
color: #006600;
|
|
44
|
+
}
|
|
45
|
+
#install {
|
|
46
|
+
display:none
|
|
47
|
+
}
|
|
48
|
+
#languages ul {
|
|
49
|
+
display:inline;
|
|
50
|
+
list-style-type:none;
|
|
51
|
+
margin:0;
|
|
52
|
+
padding:0;
|
|
53
|
+
}
|
|
54
|
+
#languages li {
|
|
55
|
+
display:inline;
|
|
56
|
+
margin:0;
|
|
57
|
+
padding:0;
|
|
58
|
+
vertical-align:bottom;
|
|
59
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @file image paste plugin for CKEditor
|
|
3
|
+
Feature introduced in: https://bugzilla.mozilla.org/show_bug.cgi?id=490879
|
|
4
|
+
doesn't include images inside HTML (paste from word): https://bugzilla.mozilla.org/show_bug.cgi?id=665341
|
|
5
|
+
* Copyright (C) 2011 Alfonso Martínez de Lizarrondo
|
|
6
|
+
*
|
|
7
|
+
* == BEGIN LICENSE ==
|
|
8
|
+
*
|
|
9
|
+
* Licensed under the terms of any of the following licenses at your
|
|
10
|
+
* choice:
|
|
11
|
+
*
|
|
12
|
+
* - GNU General Public License Version 2 or later (the "GPL")
|
|
13
|
+
* http://www.gnu.org/licenses/gpl.html
|
|
14
|
+
*
|
|
15
|
+
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
|
16
|
+
* http://www.gnu.org/licenses/lgpl.html
|
|
17
|
+
*
|
|
18
|
+
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
|
19
|
+
* http://www.mozilla.org/MPL/MPL-1.1.html
|
|
20
|
+
*
|
|
21
|
+
* == END LICENSE ==
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
// Handles image pasting in Firefox
|
|
26
|
+
CKEDITOR.plugins.add( 'imagepaste',
|
|
27
|
+
{
|
|
28
|
+
init : function( editor )
|
|
29
|
+
{
|
|
30
|
+
|
|
31
|
+
// Paste from clipboard:
|
|
32
|
+
editor.on( 'paste', function(e) {
|
|
33
|
+
|
|
34
|
+
var html = e.data.html;
|
|
35
|
+
if (!html)
|
|
36
|
+
return;
|
|
37
|
+
|
|
38
|
+
// Replace data: images in Firefox and upload them
|
|
39
|
+
e.data.html = html.replace( /<img src="data:image\/png;base64,.*?" alt="">/g, function( img )
|
|
40
|
+
{
|
|
41
|
+
var data = img.match(/"data:image\/png;base64,(.*?)"/)[1];
|
|
42
|
+
var id = CKEDITOR.tools.getNextId();
|
|
43
|
+
|
|
44
|
+
var url= editor.config.filebrowserImageUploadUrl + '&CKEditor=' + editor.name + '&CKEditorFuncNum=2&langCode=' + editor.langCode;
|
|
45
|
+
|
|
46
|
+
var xhr = new XMLHttpRequest();
|
|
47
|
+
|
|
48
|
+
xhr.open("POST", url);
|
|
49
|
+
xhr.onload = function() {
|
|
50
|
+
// Upon finish, get the url and update the file
|
|
51
|
+
var imageUrl = xhr.responseText.match(/2,\s*'(.*?)',/)[1];
|
|
52
|
+
var theImage = editor.document.getById( id );
|
|
53
|
+
theImage.data( 'cke-saved-src', imageUrl);
|
|
54
|
+
theImage.setAttribute( 'src', imageUrl);
|
|
55
|
+
theImage.removeAttribute( 'id' );
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Create the multipart data upload. Is it possible somehow to use FormData instead?
|
|
59
|
+
var BOUNDARY = "---------------------------1966284435497298061834782736";
|
|
60
|
+
var rn = "\r\n";
|
|
61
|
+
var req = "--" + BOUNDARY;
|
|
62
|
+
|
|
63
|
+
req += rn + "Content-Disposition: form-data; name=\"upload\"";
|
|
64
|
+
|
|
65
|
+
var bin = window.atob( data );
|
|
66
|
+
// add timestamp?
|
|
67
|
+
req += "; filename=\"" + id + ".png\"" + rn + "Content-type: image/png";
|
|
68
|
+
|
|
69
|
+
req += rn + rn + bin + rn + "--" + BOUNDARY;
|
|
70
|
+
|
|
71
|
+
req += "--";
|
|
72
|
+
|
|
73
|
+
xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + BOUNDARY);
|
|
74
|
+
xhr.sendAsBinary(req);
|
|
75
|
+
|
|
76
|
+
return img.replace(/>/, ' id="' + id + '">')
|
|
77
|
+
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
} //Init
|
|
82
|
+
} );
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @fileOverview stylesheetParser plugin.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
(function() {
|
|
11
|
+
// We want to extract only the elements with classes defined in the stylesheets:
|
|
12
|
+
function parseClasses( aRules, skipSelectors, validSelectors ) {
|
|
13
|
+
// aRules are just the different rules in the style sheets
|
|
14
|
+
// We want to merge them and them split them by commas, so we end up with only
|
|
15
|
+
// the selectors
|
|
16
|
+
var s = aRules.join( ' ' );
|
|
17
|
+
// Remove selectors splitting the elements, leave only the class selector (.)
|
|
18
|
+
s = s.replace( /(,|>|\+|~)/g, ' ' );
|
|
19
|
+
// Remove attribute selectors: table[border="0"]
|
|
20
|
+
s = s.replace( /\[[^\]]*/g, '' );
|
|
21
|
+
// Remove Ids: div#main
|
|
22
|
+
s = s.replace( /#[^\s]*/g, '' );
|
|
23
|
+
// Remove pseudo-selectors and pseudo-elements: :hover :nth-child(2n+1) ::before
|
|
24
|
+
s = s.replace( /\:{1,2}[^\s]*/g, '' );
|
|
25
|
+
|
|
26
|
+
s = s.replace( /\s+/g, ' ' );
|
|
27
|
+
|
|
28
|
+
var aSelectors = s.split( ' ' ),
|
|
29
|
+
aClasses = [];
|
|
30
|
+
|
|
31
|
+
for ( var i = 0; i < aSelectors.length; i++ ) {
|
|
32
|
+
var selector = aSelectors[ i ];
|
|
33
|
+
|
|
34
|
+
if ( validSelectors.test( selector ) && !skipSelectors.test( selector ) ) {
|
|
35
|
+
// If we still don't know about this one, add it
|
|
36
|
+
if ( CKEDITOR.tools.indexOf( aClasses, selector ) == -1 )
|
|
37
|
+
aClasses.push( selector );
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return aClasses;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function LoadStylesCSS( theDoc, skipSelectors, validSelectors ) {
|
|
45
|
+
var styles = [],
|
|
46
|
+
// It will hold all the rules of the applied stylesheets (except those internal to CKEditor)
|
|
47
|
+
aRules = [],
|
|
48
|
+
i;
|
|
49
|
+
|
|
50
|
+
for ( i = 0; i < theDoc.styleSheets.length; i++ ) {
|
|
51
|
+
var sheet = theDoc.styleSheets[ i ],
|
|
52
|
+
node = sheet.ownerNode || sheet.owningElement;
|
|
53
|
+
|
|
54
|
+
// Skip the internal stylesheets
|
|
55
|
+
if ( node.getAttribute( 'data-cke-temp' ) )
|
|
56
|
+
continue;
|
|
57
|
+
|
|
58
|
+
// Exclude stylesheets injected by extensions
|
|
59
|
+
if ( sheet.href && sheet.href.substr( 0, 9 ) == 'chrome://' )
|
|
60
|
+
continue;
|
|
61
|
+
|
|
62
|
+
// Bulletproof with x-domain content stylesheet.
|
|
63
|
+
try {
|
|
64
|
+
var sheetRules = sheet.cssRules || sheet.rules;
|
|
65
|
+
for ( var j = 0; j < sheetRules.length; j++ )
|
|
66
|
+
aRules.push( sheetRules[ j ].selectorText );
|
|
67
|
+
} catch ( e ) {}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
var aClasses = parseClasses( aRules, skipSelectors, validSelectors );
|
|
71
|
+
|
|
72
|
+
// Add each style to our "Styles" collection.
|
|
73
|
+
for ( i = 0; i < aClasses.length; i++ ) {
|
|
74
|
+
var oElement = aClasses[ i ].split( '.' ),
|
|
75
|
+
element = oElement[ 0 ].toLowerCase(),
|
|
76
|
+
sClassName = oElement[ 1 ];
|
|
77
|
+
|
|
78
|
+
styles.push({
|
|
79
|
+
name: element + '.' + sClassName,
|
|
80
|
+
element: element,
|
|
81
|
+
attributes: { 'class': sClassName }
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return styles;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Register a plugin named "stylesheetparser".
|
|
89
|
+
CKEDITOR.plugins.add( 'stylesheetparser', {
|
|
90
|
+
init: function( editor ) {
|
|
91
|
+
// Stylesheet parser is incompatible with filter (#10136).
|
|
92
|
+
editor.filter.disable();
|
|
93
|
+
|
|
94
|
+
var cachedDefinitions;
|
|
95
|
+
|
|
96
|
+
editor.once( 'stylesSet', function( evt ) {
|
|
97
|
+
// Cancel event and fire it again when styles are ready.
|
|
98
|
+
evt.cancel();
|
|
99
|
+
|
|
100
|
+
// Overwrite editor#getStylesSet asap (contentDom is the first moment
|
|
101
|
+
// when editor.document is ready), but before stylescombo reads styles set (priority 5).
|
|
102
|
+
editor.once( 'contentDom', function() {
|
|
103
|
+
editor.getStylesSet( function( definitions ) {
|
|
104
|
+
// Rules that must be skipped
|
|
105
|
+
var skipSelectors = editor.config.stylesheetParser_skipSelectors || ( /(^body\.|^\.)/i ),
|
|
106
|
+
// Rules that are valid
|
|
107
|
+
validSelectors = editor.config.stylesheetParser_validSelectors || ( /\w+\.\w+/ );
|
|
108
|
+
|
|
109
|
+
cachedDefinitions = definitions.concat( LoadStylesCSS( editor.document.$, skipSelectors, validSelectors ) );
|
|
110
|
+
|
|
111
|
+
editor.getStylesSet = function( callback ) {
|
|
112
|
+
if ( cachedDefinitions )
|
|
113
|
+
return callback( cachedDefinitions );
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
editor.fire( 'stylesSet', { styles: cachedDefinitions } );
|
|
117
|
+
} );
|
|
118
|
+
} );
|
|
119
|
+
}, null, null, 1 );
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
})();
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* A regular expression that defines whether a CSS rule will be
|
|
127
|
+
* skipped by the Stylesheet Parser plugin. A CSS rule matching
|
|
128
|
+
* the regular expression will be ignored and will not be available
|
|
129
|
+
* in the Styles drop-down list.
|
|
130
|
+
*
|
|
131
|
+
* // Ignore rules for body and caption elements, classes starting with "high", and any class defined for no specific element.
|
|
132
|
+
* config.stylesheetParser_skipSelectors = /(^body\.|^caption\.|\.high|^\.)/i;
|
|
133
|
+
*
|
|
134
|
+
* @since 3.6
|
|
135
|
+
* @cfg {RegExp} [stylesheetParser_skipSelectors=/(^body\.|^\.)/i]
|
|
136
|
+
* @member CKEDITOR.config
|
|
137
|
+
* @see CKEDITOR.config#stylesheetParser_validSelectors
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* A regular expression that defines which CSS rules will be used
|
|
142
|
+
* by the Stylesheet Parser plugin. A CSS rule matching the regular
|
|
143
|
+
* expression will be available in the Styles drop-down list.
|
|
144
|
+
*
|
|
145
|
+
* // Only add rules for p and span elements.
|
|
146
|
+
* config.stylesheetParser_validSelectors = /\^(p|span)\.\w+/;
|
|
147
|
+
*
|
|
148
|
+
* @since 3.6
|
|
149
|
+
* @cfg {RegExp} [stylesheetParser_validSelectors=/\w+\.\w+/]
|
|
150
|
+
* @member CKEDITOR.config
|
|
151
|
+
* @see CKEDITOR.config#stylesheetParser_skipSelectors
|
|
152
|
+
*/
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
body
|
|
2
|
+
{
|
|
3
|
+
font-family: Arial, Verdana, sans-serif;
|
|
4
|
+
font-size: 12px;
|
|
5
|
+
color: #222;
|
|
6
|
+
background-color: #fff;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* preserved spaces for rtl list item bullets. (#6249)*/
|
|
10
|
+
ol,ul,dl
|
|
11
|
+
{
|
|
12
|
+
padding-right:40px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
h1,h2,h3,h4
|
|
16
|
+
{
|
|
17
|
+
font-family: Georgia, Times, serif;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
h1.lightBlue
|
|
21
|
+
{
|
|
22
|
+
color: #00A6C7;
|
|
23
|
+
font-size: 1.8em;
|
|
24
|
+
font-weight:normal;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
h3.green
|
|
28
|
+
{
|
|
29
|
+
color: #739E39;
|
|
30
|
+
font-weight:normal;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
span.markYellow { background-color: yellow; }
|
|
34
|
+
span.markGreen { background-color: lime; }
|
|
35
|
+
|
|
36
|
+
img.left
|
|
37
|
+
{
|
|
38
|
+
padding: 5px;
|
|
39
|
+
margin-right: 5px;
|
|
40
|
+
float:left;
|
|
41
|
+
border:2px solid #DDD;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
img.right
|
|
45
|
+
{
|
|
46
|
+
padding: 5px;
|
|
47
|
+
margin-right: 5px;
|
|
48
|
+
float:right;
|
|
49
|
+
border:2px solid #DDD;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
a.green
|
|
53
|
+
{
|
|
54
|
+
color:#739E39;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
table.grey
|
|
58
|
+
{
|
|
59
|
+
background-color : #F5F5F5;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
table.grey th
|
|
63
|
+
{
|
|
64
|
+
background-color : #DDD;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
ul.square
|
|
68
|
+
{
|
|
69
|
+
list-style-type : square;
|
|
70
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<!--
|
|
3
|
+
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
|
4
|
+
For licensing, see LICENSE.md or http://ckeditor.com/license
|
|
5
|
+
-->
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<title>Using Stylesheet Parser Plugin — CKEditor Sample</title>
|
|
9
|
+
<meta charset="utf-8">
|
|
10
|
+
<script src="../../../ckeditor.js"></script>
|
|
11
|
+
<script src="../../../samples/sample.js"></script>
|
|
12
|
+
<link rel="stylesheet" href="../../../samples/sample.css">
|
|
13
|
+
<meta name="ckeditor-sample-required-plugins" content="stylescombo">
|
|
14
|
+
<meta name="ckeditor-sample-name" content="Stylesheet Parser plugin">
|
|
15
|
+
<meta name="ckeditor-sample-description" content="Using the Stylesheet Parser plugin to fill the Styles drop-down list based on the CSS classes available in the document stylesheet.">
|
|
16
|
+
<meta name="ckeditor-sample-group" content="Plugins">
|
|
17
|
+
</head>
|
|
18
|
+
<body>
|
|
19
|
+
<h1 class="samples">
|
|
20
|
+
<a href="../../../samples/index.html">CKEditor Samples</a> » Using the Stylesheet Parser Plugin
|
|
21
|
+
</h1>
|
|
22
|
+
<div class="description">
|
|
23
|
+
<p>
|
|
24
|
+
This sample shows how to configure CKEditor instances to use the
|
|
25
|
+
<strong>Stylesheet Parser</strong> (<code>stylesheetparser</code>) plugin that fills
|
|
26
|
+
the <strong>Styles</strong> drop-down list based on the CSS rules available in the document stylesheet.
|
|
27
|
+
</p>
|
|
28
|
+
<p>
|
|
29
|
+
To add a CKEditor instance using the <code>stylesheetparser</code> plugin, insert
|
|
30
|
+
the following JavaScript call into your code:
|
|
31
|
+
</p>
|
|
32
|
+
<pre class="samples">
|
|
33
|
+
CKEDITOR.replace( '<em>textarea_id</em>', {
|
|
34
|
+
<strong>extraPlugins: 'stylesheetparser'</strong>
|
|
35
|
+
});</pre>
|
|
36
|
+
<p>
|
|
37
|
+
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
|
|
38
|
+
the <code><textarea></code> element to be replaced with CKEditor.
|
|
39
|
+
</p>
|
|
40
|
+
</div>
|
|
41
|
+
<form action="../../../samples/sample_posteddata.php" method="post">
|
|
42
|
+
<p>
|
|
43
|
+
<label for="editor1">
|
|
44
|
+
CKEditor using the <code>stylesheetparser</code> plugin with its default configuration:
|
|
45
|
+
</label>
|
|
46
|
+
<textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
|
47
|
+
<script>
|
|
48
|
+
|
|
49
|
+
// This call can be placed at any point after the
|
|
50
|
+
// <textarea>, or inside a <head><script> in a
|
|
51
|
+
// window.onload event handler.
|
|
52
|
+
|
|
53
|
+
// Replace the <textarea id="editor"> with an CKEditor
|
|
54
|
+
// instance, using default configurations.
|
|
55
|
+
CKEDITOR.replace( 'editor1' , {
|
|
56
|
+
extraPlugins: 'stylesheetparser',
|
|
57
|
+
|
|
58
|
+
// Stylesheet for the contents.
|
|
59
|
+
contentsCss: 'assets/sample.css',
|
|
60
|
+
|
|
61
|
+
// Do not load the default Styles configuration.
|
|
62
|
+
stylesSet: []
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
</script>
|
|
66
|
+
</p>
|
|
67
|
+
<p>
|
|
68
|
+
<input type="submit" value="Submit">
|
|
69
|
+
</p>
|
|
70
|
+
</form>
|
|
71
|
+
<div id="footer">
|
|
72
|
+
<hr>
|
|
73
|
+
<p>
|
|
74
|
+
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
|
75
|
+
</p>
|
|
76
|
+
<p id="copy">
|
|
77
|
+
Copyright © 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
|
78
|
+
Knabben. All rights reserved.
|
|
79
|
+
</p>
|
|
80
|
+
</div>
|
|
81
|
+
</body>
|
|
82
|
+
</html>
|