projects
/
ckeditor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
b9e364c
)
Application du style sur sélection de fragments (au sens xml).
author
Benoît Pin
<benoit.pin@gmail.com>
Thu, 31 Jul 2014 13:59:24 +0000
(15:59 +0200)
committer
Benoît Pin
<benoit.pin@gmail.com>
Thu, 31 Jul 2014 13:59:24 +0000
(15:59 +0200)
skins/ckeditor/plugins/plinn_styles/plugin.js
patch
|
blob
|
history
diff --git
a/skins/ckeditor/plugins/plinn_styles/plugin.js
b/skins/ckeditor/plugins/plinn_styles/plugin.js
index
245a0e1
..
7301c07
100644
(file)
--- a/
skins/ckeditor/plugins/plinn_styles/plugin.js
+++ b/
skins/ckeditor/plugins/plinn_styles/plugin.js
@@
-33,17
+33,28
@@
PlinnStylesCombo.prototype.init = function() {
PlinnStylesCombo.prototype.onClick = function(value) {
this.editor.focus();
PlinnStylesCombo.prototype.onClick = function(value) {
this.editor.focus();
- this.editor.fire(
'saveSnapshot'
);
+ this.editor.fire(
'saveSnapshot'
);
var style = this.styles[value]
var className = style.className;
var style = this.styles[value]
var className = style.className;
+ var ranges = this.editor.getSelection().getRanges();
var element = this.editor.elementPath().lastElement;
var element = this.editor.elementPath().lastElement;
+ if(ranges.length === 1) {
+ var start = ranges[0].startContainer;
+ var end = ranges[0].endContainer;
+ if(start.$ !== end.$) {
+ // selection is a fragment that need to be wrapped in container to apply style
+ element = new CKEDITOR.dom.element('div');
+ element.append(ranges[0].cloneContents());
+ this.editor.insertElement(element);
+ }
+ }
if (element.hasClass(className)) {
element.removeClass(className);
}
else {
element.addClass(className);
}
if (element.hasClass(className)) {
element.removeClass(className);
}
else {
element.addClass(className);
}
- this.editor.fire(
'saveSnapshot'
);
+ this.editor.fire(
'saveSnapshot'
);
};
var PlinnStylePlugin = function() {
};
var PlinnStylePlugin = function() {