@alitons/ckeditor5 0.0.26 → 0.0.28
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.
- package/build/ckeditor.js +2 -2
- package/build/ckeditor.js.map +1 -1
- package/package.json +1 -1
- package/src/css/sei.css +5 -0
- package/src/plugins/listaNumerada.ts +21 -4
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@alitons/ckeditor5",
|
|
3
3
|
"author": "Aliton Silva",
|
|
4
4
|
"description": "Ckeditor 5 Personalizado adicionados campos para atender as demandas da SEAD/AC",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.28",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
7
7
|
"private": false,
|
|
8
8
|
"main": "./build/ckeditor.js",
|
package/src/css/sei.css
CHANGED
|
@@ -194,18 +194,16 @@ export default class NumberedDivList extends Plugin {
|
|
|
194
194
|
const model = editor.model;
|
|
195
195
|
const root = model.document.getRoot();
|
|
196
196
|
if(root) {
|
|
197
|
-
console.log('root', root);
|
|
198
197
|
checkChildrenIsList(root, 0);
|
|
199
198
|
}
|
|
200
199
|
});
|
|
201
200
|
|
|
202
201
|
async function checkChildrenIsList(contents: any, nivel: number) {
|
|
203
202
|
for await ( const child of contents.getChildren() ) {
|
|
203
|
+
// verifica se o elemento acima é um numItem
|
|
204
|
+
const elementBefore = child?.index > 0 ? child.parent.getChild(child.index - 1) : null;
|
|
204
205
|
if ( child?.is('element', 'numList') ) {
|
|
205
|
-
// verifica se o elemento acima é um numItem
|
|
206
|
-
const elementBefore = child?.index > 0 ? child.parent.getChild(child.index - 1) : null;
|
|
207
206
|
if(elementBefore?.is('element', 'numItem')) {
|
|
208
|
-
console.log('move o numList', child , 'para dentro do numItem', elementBefore);
|
|
209
207
|
// move todo o numList para dentro do numItem acima
|
|
210
208
|
editor.model.change( (writer: any) => {
|
|
211
209
|
writer.move( writer.createRangeOn( child ), writer.createPositionAt( elementBefore, 'end' ) );
|
|
@@ -236,6 +234,25 @@ export default class NumberedDivList extends Plugin {
|
|
|
236
234
|
}
|
|
237
235
|
|
|
238
236
|
checkChildrenIsList(child, nivel + 1);
|
|
237
|
+
} else if ( !child.is('element', 'numItem') && elementBefore?.is('element', 'numItem') ) {
|
|
238
|
+
// verifica se tem style
|
|
239
|
+
const getStyles = child?.getAttribute('htmlPAttributes') ?? child?.getAttribute('style') ?? null;
|
|
240
|
+
if(getStyles) {
|
|
241
|
+
const styles = getStyles.styles ?? getStyles ?? null;
|
|
242
|
+
if(styles) {
|
|
243
|
+
for await( const key of Object.keys(styles) ) {
|
|
244
|
+
if(['font-size', 'margin', 'margin-top', 'margin-bottom', 'margin-left', 'margin-right', 'text-indent', 'word-spacing'].includes(key)) {
|
|
245
|
+
styles[key] = styles[key]?.replaceAll('pt', 'px');
|
|
246
|
+
}
|
|
247
|
+
if(['font-size'].includes(key) && ['small', 'medium', 'large', 'x-large', 'xx-large'].includes(styles[key])) {
|
|
248
|
+
delete styles[key];
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
editor.model.change( (writer: any) => {
|
|
254
|
+
writer.move( writer.createRangeOn( child ), writer.createPositionAt( elementBefore, 'end' ) );
|
|
255
|
+
});
|
|
239
256
|
}
|
|
240
257
|
}
|
|
241
258
|
}
|