diff options
Diffstat (limited to 'sources/plugins/div')
-rw-r--r-- | sources/plugins/div/dialogs/div.js | 34 | ||||
-rw-r--r-- | sources/plugins/div/lang/es-mx.js | 19 | ||||
-rw-r--r-- | sources/plugins/div/lang/ja.js | 4 | ||||
-rw-r--r-- | sources/plugins/div/lang/pt.js | 4 | ||||
-rw-r--r-- | sources/plugins/div/plugin.js | 4 |
5 files changed, 52 insertions, 13 deletions
diff --git a/sources/plugins/div/dialogs/div.js b/sources/plugins/div/dialogs/div.js index 140424f..73dde56 100644 --- a/sources/plugins/div/dialogs/div.js +++ b/sources/plugins/div/dialogs/div.js | |||
@@ -44,7 +44,7 @@ | |||
44 | var container = editor.elementPath( element ).blockLimit; | 44 | var container = editor.elementPath( element ).blockLimit; |
45 | 45 | ||
46 | // Never consider read-only (i.e. contenteditable=false) element as | 46 | // Never consider read-only (i.e. contenteditable=false) element as |
47 | // a first div limit (#11083). | 47 | // a first div limit (http://dev.ckeditor.com/ticket/11083). |
48 | if ( container.isReadOnly() ) | 48 | if ( container.isReadOnly() ) |
49 | container = container.getParent(); | 49 | container = container.getParent(); |
50 | 50 | ||
@@ -131,12 +131,24 @@ | |||
131 | var ancestor, divElement; | 131 | var ancestor, divElement; |
132 | 132 | ||
133 | for ( i = 0; i < blockGroups.length; i++ ) { | 133 | for ( i = 0; i < blockGroups.length; i++ ) { |
134 | // Sometimes we could get empty block group if all elements inside it | ||
135 | // don't have parent's nodes (http://dev.ckeditor.com/ticket/13585). | ||
136 | if ( !blockGroups[ i ].length ) { | ||
137 | continue; | ||
138 | } | ||
139 | |||
134 | var currentNode = blockGroups[ i ][ 0 ]; | 140 | var currentNode = blockGroups[ i ][ 0 ]; |
135 | 141 | ||
136 | // Calculate the common parent node of all contained elements. | 142 | // Calculate the common parent node of all contained elements. |
137 | ancestor = currentNode.getParent(); | 143 | ancestor = currentNode.getParent(); |
138 | for ( j = 1; j < blockGroups[ i ].length; j++ ) | 144 | for ( j = 1; j < blockGroups[ i ].length; j++ ) { |
139 | ancestor = ancestor.getCommonAncestor( blockGroups[ i ][ j ] ); | 145 | ancestor = ancestor.getCommonAncestor( blockGroups[ i ][ j ] ); |
146 | } | ||
147 | |||
148 | // If there is no ancestor, mark editable as one (http://dev.ckeditor.com/ticket/13585). | ||
149 | if ( !ancestor ) { | ||
150 | ancestor = editor.editable(); | ||
151 | } | ||
140 | 152 | ||
141 | divElement = new CKEDITOR.dom.element( 'div', editor.document ); | 153 | divElement = new CKEDITOR.dom.element( 'div', editor.document ); |
142 | 154 | ||
@@ -144,8 +156,10 @@ | |||
144 | for ( j = 0; j < blockGroups[ i ].length; j++ ) { | 156 | for ( j = 0; j < blockGroups[ i ].length; j++ ) { |
145 | currentNode = blockGroups[ i ][ j ]; | 157 | currentNode = blockGroups[ i ][ j ]; |
146 | 158 | ||
147 | while ( !currentNode.getParent().equals( ancestor ) ) | 159 | // Check if the currentNode has a parent before attempting to operate on it (http://dev.ckeditor.com/ticket/13585). |
160 | while ( currentNode.getParent() && !currentNode.getParent().equals( ancestor ) ) { | ||
148 | currentNode = currentNode.getParent(); | 161 | currentNode = currentNode.getParent(); |
162 | } | ||
149 | 163 | ||
150 | // This could introduce some duplicated elements in array. | 164 | // This could introduce some duplicated elements in array. |
151 | blockGroups[ i ][ j ] = currentNode; | 165 | blockGroups[ i ][ j ] = currentNode; |
@@ -160,8 +174,9 @@ | |||
160 | currentNode.is && CKEDITOR.dom.element.setMarker( database, currentNode, 'block_processed', true ); | 174 | currentNode.is && CKEDITOR.dom.element.setMarker( database, currentNode, 'block_processed', true ); |
161 | 175 | ||
162 | // Establish new container, wrapping all elements in this group. | 176 | // Establish new container, wrapping all elements in this group. |
163 | if ( !j ) | 177 | if ( !j ) { |
164 | divElement.insertBefore( currentNode ); | 178 | divElement.insertBefore( currentNode ); |
179 | } | ||
165 | 180 | ||
166 | divElement.append( currentNode ); | 181 | divElement.append( currentNode ); |
167 | } | 182 | } |
@@ -192,8 +207,13 @@ | |||
192 | lastDivLimit = limit; | 207 | lastDivLimit = limit; |
193 | groups.push( [] ); | 208 | groups.push( [] ); |
194 | } | 209 | } |
195 | groups[ groups.length - 1 ].push( block ); | 210 | |
211 | // Sometimes we got nodes that are not inside the DOM, which causes error (http://dev.ckeditor.com/ticket/13585). | ||
212 | if ( block.getParent() ) { | ||
213 | groups[ groups.length - 1 ].push( block ); | ||
214 | } | ||
196 | } | 215 | } |
216 | |||
197 | return groups; | 217 | return groups; |
198 | } | 218 | } |
199 | 219 | ||
@@ -368,7 +388,7 @@ | |||
368 | // it if no options are available at all. | 388 | // it if no options are available at all. |
369 | stylesField[ stylesField.items.length > 1 ? 'enable' : 'disable' ](); | 389 | stylesField[ stylesField.items.length > 1 ? 'enable' : 'disable' ](); |
370 | 390 | ||
371 | // Now setup the field value manually if dialog was opened on element. (#9689) | 391 | // Now setup the field value manually if dialog was opened on element. (http://dev.ckeditor.com/ticket/9689) |
372 | setTimeout( function() { | 392 | setTimeout( function() { |
373 | dialog._element && stylesField.setup( dialog._element ); | 393 | dialog._element && stylesField.setup( dialog._element ); |
374 | }, 0 ); | 394 | }, 0 ); |
@@ -402,7 +422,7 @@ | |||
402 | this.hide(); | 422 | this.hide(); |
403 | }, | 423 | }, |
404 | onHide: function() { | 424 | onHide: function() { |
405 | // Remove style only when editing existing DIV. (#6315) | 425 | // Remove style only when editing existing DIV. (http://dev.ckeditor.com/ticket/6315) |
406 | if ( command == 'editdiv' ) | 426 | if ( command == 'editdiv' ) |
407 | this._element.removeCustomData( 'elementStyle' ); | 427 | this._element.removeCustomData( 'elementStyle' ); |
408 | delete this._element; | 428 | delete this._element; |
diff --git a/sources/plugins/div/lang/es-mx.js b/sources/plugins/div/lang/es-mx.js new file mode 100644 index 0000000..f3ef630 --- /dev/null +++ b/sources/plugins/div/lang/es-mx.js | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. | ||
3 | For licensing, see LICENSE.md or http://ckeditor.com/license | ||
4 | */ | ||
5 | CKEDITOR.plugins.setLang( 'div', 'es-mx', { | ||
6 | IdInputLabel: 'Id', | ||
7 | advisoryTitleInputLabel: 'Título del anuncio', | ||
8 | cssClassInputLabel: 'Clases de la hoja de estilos', | ||
9 | edit: 'Editar Div', | ||
10 | inlineStyleInputLabel: 'Estilo de línea', | ||
11 | langDirLTRLabel: 'Izquierda a Derecha (LTR)', | ||
12 | langDirLabel: 'Dirección de idiomas', | ||
13 | langDirRTLLabel: 'Derecha a Izquierda (RTL)', | ||
14 | languageCodeInputLabel: 'Código del idioma', | ||
15 | remove: 'Remover Div', | ||
16 | styleSelectLabel: 'Estilo', | ||
17 | title: 'Crear contenedor Div', | ||
18 | toolbar: 'Crear contenedor Div' | ||
19 | } ); | ||
diff --git a/sources/plugins/div/lang/ja.js b/sources/plugins/div/lang/ja.js index 50abe05..263326e 100644 --- a/sources/plugins/div/lang/ja.js +++ b/sources/plugins/div/lang/ja.js | |||
@@ -14,6 +14,6 @@ CKEDITOR.plugins.setLang( 'div', 'ja', { | |||
14 | languageCodeInputLabel: ' 言語コード', | 14 | languageCodeInputLabel: ' 言語コード', |
15 | remove: 'Divコンテナを削除', | 15 | remove: 'Divコンテナを削除', |
16 | styleSelectLabel: 'スタイル', | 16 | styleSelectLabel: 'スタイル', |
17 | title: 'Divコンテナ', | 17 | title: 'Divコンテナを作成', |
18 | toolbar: 'Divコンテナ' | 18 | toolbar: 'Divコンテナを作成' |
19 | } ); | 19 | } ); |
diff --git a/sources/plugins/div/lang/pt.js b/sources/plugins/div/lang/pt.js index 5df020c..554e2c4 100644 --- a/sources/plugins/div/lang/pt.js +++ b/sources/plugins/div/lang/pt.js | |||
@@ -7,11 +7,11 @@ CKEDITOR.plugins.setLang( 'div', 'pt', { | |||
7 | advisoryTitleInputLabel: 'Título', | 7 | advisoryTitleInputLabel: 'Título', |
8 | cssClassInputLabel: 'Classes de folhas de estilo', | 8 | cssClassInputLabel: 'Classes de folhas de estilo', |
9 | edit: 'Editar Div', | 9 | edit: 'Editar Div', |
10 | inlineStyleInputLabel: 'Estilho em Linha', | 10 | inlineStyleInputLabel: 'Estilo na etiqueta', |
11 | langDirLTRLabel: 'Esquerda para a direita (EPD)', | 11 | langDirLTRLabel: 'Esquerda para a direita (EPD)', |
12 | langDirLabel: 'Orientação de idioma', | 12 | langDirLabel: 'Orientação de idioma', |
13 | langDirRTLLabel: 'Direita para a Esquerda (DPE)', | 13 | langDirRTLLabel: 'Direita para a Esquerda (DPE)', |
14 | languageCodeInputLabel: 'Codigo do Idioma', | 14 | languageCodeInputLabel: 'Código do idioma', |
15 | remove: 'Remover Div', | 15 | remove: 'Remover Div', |
16 | styleSelectLabel: 'Estilo', | 16 | styleSelectLabel: 'Estilo', |
17 | title: 'Criar Div', | 17 | title: 'Criar Div', |
diff --git a/sources/plugins/div/plugin.js b/sources/plugins/div/plugin.js index dbced72..a64d9e9 100644 --- a/sources/plugins/div/plugin.js +++ b/sources/plugins/div/plugin.js | |||
@@ -12,7 +12,7 @@ | |||
12 | CKEDITOR.plugins.add( 'div', { | 12 | CKEDITOR.plugins.add( 'div', { |
13 | requires: 'dialog', | 13 | requires: 'dialog', |
14 | // jscs:disable maximumLineLength | 14 | // jscs:disable maximumLineLength |
15 | lang: 'af,ar,az,bg,bn,bs,ca,cs,cy,da,de,de-ch,el,en,en-au,en-ca,en-gb,eo,es,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,oc,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE% | 15 | lang: 'af,ar,az,bg,bn,bs,ca,cs,cy,da,de,de-ch,el,en,en-au,en-ca,en-gb,eo,es,es-mx,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,oc,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE% |
16 | // jscs:enable maximumLineLength | 16 | // jscs:enable maximumLineLength |
17 | icons: 'creatediv', // %REMOVE_LINE_CORE% | 17 | icons: 'creatediv', // %REMOVE_LINE_CORE% |
18 | hidpi: true, // %REMOVE_LINE_CORE% | 18 | hidpi: true, // %REMOVE_LINE_CORE% |
@@ -126,7 +126,7 @@ | |||
126 | getSurroundDiv: function( editor, start ) { | 126 | getSurroundDiv: function( editor, start ) { |
127 | var path = editor.elementPath( start ); | 127 | var path = editor.elementPath( start ); |
128 | return editor.elementPath( path.blockLimit ).contains( function( node ) { | 128 | return editor.elementPath( path.blockLimit ).contains( function( node ) { |
129 | // Avoid read-only (i.e. contenteditable="false") divs (#11083). | 129 | // Avoid read-only (i.e. contenteditable="false") divs (http://dev.ckeditor.com/ticket/11083). |
130 | return node.is( 'div' ) && !node.isReadOnly(); | 130 | return node.is( 'div' ) && !node.isReadOnly(); |
131 | }, 1 ); | 131 | }, 1 ); |
132 | } | 132 | } |