@alitons/ckeditor5 0.0.4 → 0.0.6

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.
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The list item view class.
3
+ */
4
+ export default class ListItemView extends View<HTMLElement> {
5
+ /**
6
+ * @inheritDoc
7
+ */
8
+ constructor(locale: any);
9
+ children: import("@ckeditor/ckeditor5-ui").ViewCollection<View<HTMLElement>>;
10
+ /**
11
+ * Focuses the list item.
12
+ */
13
+ focus(): void;
14
+ }
15
+ import View from "@ckeditor/ckeditor5-ui/src/view";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The list separator view class.
3
+ */
4
+ export default class ListSeparatorView {
5
+ /**
6
+ * @inheritDoc
7
+ */
8
+ constructor(locale: any);
9
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The list view class.
3
+ */
4
+ export default class ListView extends View<HTMLElement> {
5
+ /**
6
+ * @inheritDoc
7
+ */
8
+ constructor(locale: any);
9
+ items: import("@ckeditor/ckeditor5-ui").ViewCollection<View<HTMLElement>>;
10
+ focusTracker: FocusTracker;
11
+ keystrokes: KeystrokeHandler;
12
+ _focusCycler: FocusCycler;
13
+ /**
14
+ * Focuses the first focusable in {@link #items}.
15
+ */
16
+ focus(): void;
17
+ /**
18
+ * Focuses the last focusable in {@link #items}.
19
+ */
20
+ focusLast(): void;
21
+ }
22
+ import View from "@ckeditor/ckeditor5-ui/src/view";
23
+ import { FocusTracker } from "@ckeditor/ckeditor5-utils";
24
+ import { KeystrokeHandler } from "@ckeditor/ckeditor5-utils";
25
+ import FocusCycler from "@ckeditor/ckeditor5-ui/src/focuscycler";
@@ -0,0 +1,6 @@
1
+ import { Plugin } from '@ckeditor/ckeditor5-core';
2
+ export default class NumberedDivListSplit extends Plugin {
3
+ static get requires(): never[];
4
+ static get pluginName(): "NumberedDivListSplit";
5
+ init(): void;
6
+ }
@@ -0,0 +1,5 @@
1
+ import { Plugin } from '@ckeditor/ckeditor5-core';
2
+ export default class NumberedDivList extends Plugin {
3
+ static get pluginName(): string;
4
+ init(): void;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { Plugin } from '@ckeditor/ckeditor5-core';
2
+ export default class NumberedDivList extends Plugin {
3
+ static get pluginName(): string;
4
+ init(): void;
5
+ }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@alitons/ckeditor5",
3
3
  "author": "Aliton Silva",
4
- "description": "Ckeditor 5 Personalizado adicionados campos para atender as demandas da SEAD/AC.",
5
- "version": "0.0.4",
4
+ "description": "Ckeditor 5 Personalizado adicionados campos para atender as demandas da SEAD/AC",
5
+ "version": "0.0.6",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
7
7
  "private": false,
8
8
  "main": "./build/ckeditor.js",
@@ -25,6 +25,7 @@
25
25
  "@ckeditor/ckeditor5-horizontal-line": "39.0.1",
26
26
  "@ckeditor/ckeditor5-html-embed": "39.0.1",
27
27
  "@ckeditor/ckeditor5-html-support": "39.0.1",
28
+ "@ckeditor/ckeditor5-icons": "^47.1.0",
28
29
  "@ckeditor/ckeditor5-image": "39.0.1",
29
30
  "@ckeditor/ckeditor5-indent": "39.0.1",
30
31
  "@ckeditor/ckeditor5-language": "39.0.1",
package/sample/index.html CHANGED
@@ -14,16 +14,26 @@
14
14
  <div data-editor="DecoupledEditor" data-collaboration="true" data-revision-history="true">
15
15
  <div class="centered">
16
16
  <div class="row">
17
- <div class="col-12">
17
+ <div class="col-12 p-0">
18
18
  <div class="document-editor__toolbar"></div>
19
19
  </div>
20
20
  <div class="col-12 row-editor">
21
21
  <div class="editor-container">
22
22
  <div class="editor" ready="initEditorPage">
23
-
23
+ <p>a</p>
24
24
  </div>
25
25
  </div>
26
26
  </div>
27
+ <div class="col-12">
28
+ <button id="get-html">Obter conteúdo HTML</button>
29
+ </div>
30
+ </div>
31
+
32
+ <div class="row">
33
+ <div class="col-12 html">
34
+ <h3>Conteúdo HTML gerado:</h3>
35
+ <textarea class="form-control" rows="10" readonly></textarea>
36
+ </div>
27
37
  </div>
28
38
  </div>
29
39
  </div>
package/sample/script.js CHANGED
@@ -34,32 +34,32 @@ watchdog.create( document.querySelector( '.editor' ), {
34
34
  },
35
35
  documentoModeloOptions: {
36
36
  categoria: {
37
- // options: [
38
- // {
39
- // autotexto: 'teste 1',
40
- // titulo: 'Primeiro teste'
41
- // }
42
- // ],
37
+ options: [
38
+ {
39
+ autotexto: 'teste 1',
40
+ titulo: 'Primeiro teste'
41
+ }
42
+ ],
43
43
  ajax: {
44
- url: 'https://compras.test/api/documento-modelo/categoria',
44
+ url: 'http://10.10.18.10/compras/api/teste',
45
45
  method: 'GET',
46
46
  data: {
47
47
  usuario: 'usuario',
48
48
  },
49
49
  results: {
50
- id: 'id_categoria_autotexto',
51
- value: 'descricao'
50
+ autotexto: 'autotexto',
51
+ titulo: 'titulo'
52
52
  }
53
53
  }
54
54
  },
55
- // options: [
56
- // {
57
- // autotexto: 'teste 1',
58
- // titulo: 'Primeiro teste'
59
- // }
60
- // ],
55
+ options: [
56
+ {
57
+ autotexto: 'teste 1',
58
+ titulo: 'Primeiro teste'
59
+ }
60
+ ],
61
61
  ajax: {
62
- url: 'https://compras.test/api/autotexto',
62
+ url: 'http://10.10.18.10/compras/api/teste',
63
63
  method: 'GET',
64
64
  data: {
65
65
  usuario: 'usuario',
@@ -90,6 +90,10 @@ watchdog.create( document.querySelector( '.editor' ), {
90
90
  }
91
91
  ]
92
92
  },
93
+ listaNumeradaOptions: {
94
+ disableEnter: true,
95
+ forceList: 3,
96
+ },
93
97
  items: [
94
98
  'salvarcomo',
95
99
  '|',
@@ -100,10 +104,14 @@ watchdog.create( document.querySelector( '.editor' ), {
100
104
  'link',
101
105
  'bulletedList',
102
106
  'numberedList',
107
+ 'numberedDivListSplit',
103
108
  '|',
104
109
  'undo',
105
110
  'redo',
106
111
  '|',
112
+ 'indent',
113
+ 'outdent',
114
+ '|',
107
115
  'autotexto',
108
116
  'importarsei',
109
117
  'documentoModelo'
@@ -111,10 +119,29 @@ watchdog.create( document.querySelector( '.editor' ), {
111
119
  },
112
120
  })
113
121
 
122
+ let prevState = watchdog.state;
123
+
124
+ watchdog.on( 'stateChange', () => {
125
+ const currentState = watchdog.state;
126
+
127
+ if ( currentState === 'crashedPermanently' ) {
128
+ watchdog.editor.enableReadOnlyMode( 'crashed-editor' );
129
+ }
130
+
131
+ prevState = currentState;
132
+ } );
133
+
114
134
  function initEditorPage(editor) {
115
135
  console.log('Editor criado:', editor);
116
136
  const toolbarContainer = document.querySelector('.document-editor__toolbar');
117
137
  toolbarContainer.appendChild( editor.ui.view.toolbar.element );
118
138
 
119
139
  editor.enableReadOnlyMode( true );
120
- }
140
+ }
141
+
142
+ document.getElementById('get-html').addEventListener('click', () => {
143
+ const editor = watchdog.editor;
144
+ const htmlContent = editor.getData();
145
+ const htmlTextarea = document.querySelector('.html textarea');
146
+ htmlTextarea.value = htmlContent;
147
+ });
package/src/ckeditor.ts CHANGED
@@ -87,6 +87,8 @@ import ImportarSei from './plugins/sei';
87
87
  import AutoTexto from './plugins/autotexto';
88
88
  import DocumentoModelo from './plugins/modelo';
89
89
  import SalvarComo from './plugins/salvarcomo';
90
+ import NumberedDivList from './plugins/listaNumerada';
91
+ import NumberedDivListSplit from './plugins/NumberedDivListSplit';
90
92
 
91
93
  import './css/custom.css';
92
94
 
@@ -169,7 +171,9 @@ class Editor extends DecoupledEditor {
169
171
  AutoTexto,
170
172
  ImportarSei,
171
173
  DocumentoModelo,
172
- SalvarComo
174
+ SalvarComo,
175
+ NumberedDivList,
176
+ NumberedDivListSplit
173
177
  ];
174
178
 
175
179
  public static override defaultConfig = {
@@ -218,7 +222,8 @@ class Editor extends DecoupledEditor {
218
222
  'autotexto',
219
223
  'importarsei',
220
224
  'documentoModelo',
221
- 'salvarcomo'
225
+ 'salvarcomo',
226
+ 'numberedDivListSplit'
222
227
  ],
223
228
  shouldNotGroupWhenFull: true
224
229
  },
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ui/list/listitemview
7
+ */
8
+ import View from '@ckeditor/ckeditor5-ui/src/view';
9
+ import type ViewCollection from '@ckeditor/ckeditor5-ui/src/viewcollection';
10
+ import type { Locale } from '@ckeditor/ckeditor5-utils';
11
+ /**
12
+ * The list item view class.
13
+ */
14
+ export default class ListItemView extends View {
15
+ /**
16
+ * Collection of the child views inside of the list item {@link #element}.
17
+ */
18
+ readonly children: ViewCollection;
19
+ /**
20
+ * Controls whether the item view is visible. Visible by default, list items are hidden
21
+ * using a CSS class.
22
+ *
23
+ * @observable
24
+ * @default true
25
+ */
26
+ isVisible: boolean;
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ constructor(locale?: Locale);
31
+ /**
32
+ * Focuses the list item.
33
+ */
34
+ focus(): void;
35
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ui/list/listitemview
7
+ */
8
+ import View from '@ckeditor/ckeditor5-ui/src/view';
9
+ /**
10
+ * The list item view class.
11
+ */
12
+ export default class ListItemView extends View {
13
+ /**
14
+ * @inheritDoc
15
+ */
16
+ constructor(locale) {
17
+ super(locale);
18
+ const bind = this.bindTemplate;
19
+ this.set('isVisible', true);
20
+ this.children = this.createCollection();
21
+ this.setTemplate({
22
+ tag: 'div',
23
+ attributes: {
24
+ class: [
25
+ 'ck',
26
+ 'ck-list-properties',
27
+ 'ck-list-properties_with',
28
+ 'ck-list-numbered-properties',
29
+ bind.if('isVisible', 'ck-hidden', value => !value)
30
+ ],
31
+ role: 'presentation'
32
+ },
33
+ children: this.children
34
+ });
35
+ }
36
+ /**
37
+ * Focuses the list item.
38
+ */
39
+ focus() {
40
+ this.children.first.focus();
41
+ }
42
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ui/list/listview
7
+ */
8
+ import View from '@ckeditor/ckeditor5-ui/src/view';
9
+ import type DropdownPanelFocusable from '@ckeditor/ckeditor5-ui/src/dropdown/dropdownpanelfocusable';
10
+ import type ViewCollection from '@ckeditor/ckeditor5-ui/src/viewcollection';
11
+ import { FocusTracker, KeystrokeHandler, type Locale } from '@ckeditor/ckeditor5-utils';
12
+ import '@ckeditor/ckeditor5-ui/theme/components/list/list.css';
13
+ /**
14
+ * The list view class.
15
+ */
16
+ export default class ListView extends View<HTMLUListElement> implements DropdownPanelFocusable {
17
+ /**
18
+ * Collection of the child list views.
19
+ */
20
+ readonly items: ViewCollection;
21
+ /**
22
+ * Tracks information about DOM focus in the list.
23
+ */
24
+ readonly focusTracker: FocusTracker;
25
+ /**
26
+ * Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
27
+ */
28
+ readonly keystrokes: KeystrokeHandler;
29
+ /**
30
+ * Label used by assistive technologies to describe this list element.
31
+ *
32
+ * @observable
33
+ */
34
+ ariaLabel: string | undefined;
35
+ /**
36
+ * The property reflected by the `role` DOM attribute to be used by assistive technologies.
37
+ *
38
+ * @observable
39
+ */
40
+ role: string | undefined;
41
+ /**
42
+ * Helps cycling over focusable {@link #items} in the list.
43
+ */
44
+ private readonly _focusCycler;
45
+ /**
46
+ * @inheritDoc
47
+ */
48
+ constructor(locale?: Locale);
49
+ /**
50
+ * @inheritDoc
51
+ */
52
+ render(): void;
53
+ /**
54
+ * @inheritDoc
55
+ */
56
+ destroy(): void;
57
+ /**
58
+ * Focuses the first focusable in {@link #items}.
59
+ */
60
+ focus(): void;
61
+ /**
62
+ * Focuses the last focusable in {@link #items}.
63
+ */
64
+ focusLast(): void;
65
+ }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ui/list/listview
7
+ */
8
+ import View from '@ckeditor/ckeditor5-ui/src/view';
9
+ import FocusCycler from '@ckeditor/ckeditor5-ui/src/focuscycler';
10
+ import { FocusTracker, KeystrokeHandler } from '@ckeditor/ckeditor5-utils';
11
+ import '@ckeditor/ckeditor5-ui/theme/components/list/list.css';
12
+ /**
13
+ * The list view class.
14
+ */
15
+ export default class ListView extends View {
16
+ /**
17
+ * @inheritDoc
18
+ */
19
+ constructor(locale) {
20
+ super(locale);
21
+ const bind = this.bindTemplate;
22
+ this.items = this.createCollection();
23
+ this.focusTracker = new FocusTracker();
24
+ this.keystrokes = new KeystrokeHandler();
25
+ this._focusCycler = new FocusCycler({
26
+ focusables: this.items,
27
+ focusTracker: this.focusTracker,
28
+ keystrokeHandler: this.keystrokes,
29
+ actions: {
30
+ // Navigate list items backwards using the arrowup key.
31
+ focusPrevious: 'arrowup',
32
+ // Navigate toolbar items forwards using the arrowdown key.
33
+ focusNext: 'arrowdown'
34
+ }
35
+ });
36
+ this.set('ariaLabel', undefined);
37
+ this.set('role', undefined);
38
+ this.setTemplate({
39
+ tag: 'div',
40
+ attributes: {
41
+ class: [
42
+ //ck ck-list-styles-list
43
+ 'ck',
44
+ //ck ck-reset ck-dropdown__panel ck-dropdown__panel_se
45
+ 'ck-list-styles-list',
46
+ 'ck-numlist-panel'
47
+ ],
48
+ role: bind.to('role'),
49
+ 'aria-label': bind.to('ariaLabel')
50
+ },
51
+ children: this.items
52
+ });
53
+ }
54
+ /**
55
+ * @inheritDoc
56
+ */
57
+ render() {
58
+ super.render();
59
+ // Items added before rendering should be known to the #focusTracker.
60
+ for (const item of this.items) {
61
+ this.focusTracker.add(item.element);
62
+ }
63
+ this.items.on('add', (evt, item) => {
64
+ this.focusTracker.add(item.element);
65
+ });
66
+ this.items.on('remove', (evt, item) => {
67
+ this.focusTracker.remove(item.element);
68
+ });
69
+ // Start listening for the keystrokes coming from #element.
70
+ this.keystrokes.listenTo(this.element);
71
+ }
72
+ /**
73
+ * @inheritDoc
74
+ */
75
+ destroy() {
76
+ super.destroy();
77
+ this.focusTracker.destroy();
78
+ this.keystrokes.destroy();
79
+ }
80
+ /**
81
+ * Focuses the first focusable in {@link #items}.
82
+ */
83
+ focus() {
84
+ this._focusCycler.focusFirst();
85
+ }
86
+ /**
87
+ * Focuses the last focusable in {@link #items}.
88
+ */
89
+ focusLast() {
90
+ this._focusCycler.focusLast();
91
+ }
92
+ }
@@ -1,3 +1,90 @@
1
1
  .select2-container--open {
2
2
  background-color: white !important;
3
+ }
4
+
5
+ ul.select2-results__options {
6
+ padding: 10px !important;
7
+ background: #fff !important;
8
+ }
9
+
10
+ :root {
11
+ --depth: -1;
12
+ }
13
+
14
+ .num-list {
15
+ --_depth: calc(var(--depth, -1) + 1);
16
+ --depth: var(--_depth);
17
+ counter-reset: numitem 0;
18
+ margin: 0;
19
+ padding: 0;
20
+ }
21
+
22
+ .num-list[start="2"] {counter-reset: numitem 1;}
23
+ .num-list[start="3"] {counter-reset: numitem 2;}
24
+ .num-list[start="4"] {counter-reset: numitem 3;}
25
+ .num-list[start="5"] {counter-reset: numitem 4;}
26
+ .num-list[start="6"] {counter-reset: numitem 5;}
27
+ .num-list[start="7"] {counter-reset: numitem 6;}
28
+ .num-list[start="8"] {counter-reset: numitem 7;}
29
+ .num-list[start="9"] {counter-reset: numitem 8;}
30
+ .num-list[start="10"] {counter-reset: numitem 9;}
31
+ .num-list[start="11"] {counter-reset: numitem 10;}
32
+ .num-list[start="12"] {counter-reset: numitem 11;}
33
+ .num-list[start="13"] {counter-reset: numitem 12;}
34
+ .num-list[start="14"] {counter-reset: numitem 13;}
35
+ .num-list[start="15"] {counter-reset: numitem 14;}
36
+ .num-list[start="16"] {counter-reset: numitem 15;}
37
+ .num-list[start="17"] {counter-reset: numitem 16;}
38
+ .num-list[start="18"] {counter-reset: numitem 17;}
39
+ .num-list[start="19"] {counter-reset: numitem 18;}
40
+ .num-list[start="20"] {counter-reset: numitem 19;}
41
+
42
+ .num-list > .num-li {
43
+ --depth: var(--depth);
44
+ padding-inline-start: calc((var(--depth) + 1) * var(--indent));
45
+ counter-increment: numitem;
46
+ position: relative;
47
+ }
48
+
49
+ .num-list:not([data-style]) > .num-li::before,
50
+ .num-list[data-style="decimal"] > .num-li::before {
51
+ content: counters(numitem, ".") ". ";
52
+ }
53
+
54
+ .num-list[data-style="lower-alpha"] > .num-li::before {
55
+ content: counter(numitem, lower-alpha) ") ";
56
+ }
57
+
58
+ .num-list[data-style="upper-alpha"] > .num-li::before {
59
+ content: counter(numitem, upper-alpha) ") ";
60
+ }
61
+
62
+ .num-list[data-style="lower-roman"] > .num-li::before {
63
+ content: counter(numitem, lower-roman) ". ";
64
+ }
65
+
66
+ .num-list[data-style="upper-roman"] > .num-li::before {
67
+ content: counter(numitem, upper-roman) ". ";
68
+ }
69
+
70
+ .num-list > .num-li::before {
71
+ position: absolute;
72
+ left: 0;
73
+ top: 0;
74
+ }
75
+
76
+ .num-list > .num-li :first-child {text-indent: 20px;}
77
+ .num-list .num-list > .num-li :first-child {text-indent: 35px;}
78
+ .num-list .num-list .num-list > .num-li :first-child {text-indent: 50px;}
79
+ .num-list .num-list .num-list .num-list > .num-li :first-child {text-indent: 65px;}
80
+ .num-list .num-list .num-list .num-list .num-list > .num-li :first-child {text-indent: 80px;}
81
+
82
+ .num-list[data-style="lower-alpha"] > .num-li :first-child,
83
+ .num-list[data-style="upper-alpha"] > .num-li :first-child,
84
+ .num-list[data-style="lower-roman"] > .num-li :first-child,
85
+ .num-list[data-style="upper-roman"] > .num-li :first-child {text-indent: 20px !important; }
86
+
87
+ .num-list,
88
+ .num-list > .num-li {
89
+ text-indent: 0px !important;
3
90
  }