@alitons/ckeditor5 0.0.2
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/LICENSE.md +49 -0
- package/README.md +262 -0
- package/build/ckeditor.d.ts +70 -0
- package/build/ckeditor.js +17 -0
- package/build/ckeditor.js.map +1 -0
- package/build/plugins/autotexto.d.ts +7 -0
- package/build/plugins/modelo.d.ts +15 -0
- package/build/plugins/salvarcomo.d.ts +5 -0
- package/build/plugins/sei.d.ts +6 -0
- package/build/translations/af.js +1 -0
- package/build/translations/ar.js +1 -0
- package/build/translations/ast.js +1 -0
- package/build/translations/az.js +1 -0
- package/build/translations/bg.js +1 -0
- package/build/translations/bn.js +1 -0
- package/build/translations/bs.js +1 -0
- package/build/translations/ca.js +1 -0
- package/build/translations/cs.js +1 -0
- package/build/translations/da.js +1 -0
- package/build/translations/de-ch.js +1 -0
- package/build/translations/de.js +1 -0
- package/build/translations/el.js +1 -0
- package/build/translations/en-au.js +1 -0
- package/build/translations/en-gb.js +1 -0
- package/build/translations/en.js +1 -0
- package/build/translations/eo.js +1 -0
- package/build/translations/es-co.js +1 -0
- package/build/translations/es.js +1 -0
- package/build/translations/et.js +1 -0
- package/build/translations/eu.js +1 -0
- package/build/translations/fa.js +1 -0
- package/build/translations/fi.js +1 -0
- package/build/translations/fr.js +1 -0
- package/build/translations/gl.js +1 -0
- package/build/translations/gu.js +1 -0
- package/build/translations/he.js +1 -0
- package/build/translations/hi.js +1 -0
- package/build/translations/hr.js +1 -0
- package/build/translations/hu.js +1 -0
- package/build/translations/id.js +1 -0
- package/build/translations/it.js +1 -0
- package/build/translations/ja.js +1 -0
- package/build/translations/jv.js +1 -0
- package/build/translations/kk.js +1 -0
- package/build/translations/km.js +1 -0
- package/build/translations/kn.js +1 -0
- package/build/translations/ko.js +1 -0
- package/build/translations/ku.js +1 -0
- package/build/translations/lt.js +1 -0
- package/build/translations/lv.js +1 -0
- package/build/translations/ms.js +1 -0
- package/build/translations/nb.js +1 -0
- package/build/translations/ne.js +1 -0
- package/build/translations/nl.js +1 -0
- package/build/translations/no.js +1 -0
- package/build/translations/oc.js +1 -0
- package/build/translations/pl.js +1 -0
- package/build/translations/pt.js +1 -0
- package/build/translations/ro.js +1 -0
- package/build/translations/ru.js +1 -0
- package/build/translations/si.js +1 -0
- package/build/translations/sk.js +1 -0
- package/build/translations/sl.js +1 -0
- package/build/translations/sq.js +1 -0
- package/build/translations/sr-latn.js +1 -0
- package/build/translations/sr.js +1 -0
- package/build/translations/sv.js +1 -0
- package/build/translations/th.js +1 -0
- package/build/translations/tk.js +1 -0
- package/build/translations/tr.js +1 -0
- package/build/translations/tt.js +1 -0
- package/build/translations/ug.js +1 -0
- package/build/translations/uk.js +1 -0
- package/build/translations/ur.js +1 -0
- package/build/translations/uz.js +1 -0
- package/build/translations/vi.js +1 -0
- package/build/translations/zh-cn.js +1 -0
- package/build/translations/zh.js +1 -0
- package/package.json +76 -0
- package/sample/index.html +34 -0
- package/sample/script.js +120 -0
- package/sample/styles.css +510 -0
- package/src/ckeditor.js +210 -0
- package/src/ckeditor.js.map +1 -0
- package/src/ckeditor.ts +255 -0
- package/src/plugins/autotexto.ts +159 -0
- package/src/plugins/modelo.ts +251 -0
- package/src/plugins/salvarcomo.ts +163 -0
- package/src/plugins/sei.ts +184 -0
- package/tsconfig.json +20 -0
- package/tsconfig.types.json +9 -0
- package/webpack.config.js +96 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ckeditor.js","sourceRoot":"","sources":["ckeditor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EACN,IAAI,EACJ,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b,kBAAkB;SAClB;QACD,sBAAsB,EAAE,IAAI;KAC5B;IACD,QAAQ,EAAE,OAAO;IACjB,KAAK,EAAE;QACN,OAAO,EAAE;YACR,sBAAsB;YACtB,oBAAoB;YACpB,mBAAmB;YACnB,kBAAkB;YAClB,iBAAiB;YACjB,WAAW;SACX;KACD;IACD,KAAK,EAAE;QACN,cAAc,EAAE;YACf,aAAa;YACb,UAAU;YACV,iBAAiB;YACjB,qBAAqB;YACrB,iBAAiB;SACjB;KACD;CACD,CAAC;AAGH,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|
package/src/ckeditor.ts
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @license Copyright (c) 2014-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
4
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import Swal from 'sweetalert2'
|
|
8
|
+
|
|
9
|
+
import { DecoupledEditor } from '@ckeditor/ckeditor5-editor-decoupled';
|
|
10
|
+
|
|
11
|
+
import { Alignment } from '@ckeditor/ckeditor5-alignment';
|
|
12
|
+
import { Autoformat } from '@ckeditor/ckeditor5-autoformat';
|
|
13
|
+
import { Autosave } from '@ckeditor/ckeditor5-autosave';
|
|
14
|
+
import {
|
|
15
|
+
Bold,
|
|
16
|
+
Code,
|
|
17
|
+
Italic,
|
|
18
|
+
Strikethrough,
|
|
19
|
+
Subscript,
|
|
20
|
+
Superscript,
|
|
21
|
+
Underline
|
|
22
|
+
} from '@ckeditor/ckeditor5-basic-styles';
|
|
23
|
+
import { BlockQuote } from '@ckeditor/ckeditor5-block-quote';
|
|
24
|
+
import { CloudServices } from '@ckeditor/ckeditor5-cloud-services';
|
|
25
|
+
import { CodeBlock } from '@ckeditor/ckeditor5-code-block';
|
|
26
|
+
import { Essentials } from '@ckeditor/ckeditor5-essentials';
|
|
27
|
+
import { FindAndReplace } from '@ckeditor/ckeditor5-find-and-replace';
|
|
28
|
+
import { FontBackgroundColor, FontColor, FontFamily, FontSize } from '@ckeditor/ckeditor5-font';
|
|
29
|
+
import { Heading } from '@ckeditor/ckeditor5-heading';
|
|
30
|
+
import { Highlight } from '@ckeditor/ckeditor5-highlight';
|
|
31
|
+
import { HorizontalLine } from '@ckeditor/ckeditor5-horizontal-line';
|
|
32
|
+
import { HtmlEmbed } from '@ckeditor/ckeditor5-html-embed';
|
|
33
|
+
import {
|
|
34
|
+
DataFilter,
|
|
35
|
+
DataSchema,
|
|
36
|
+
GeneralHtmlSupport,
|
|
37
|
+
HtmlComment
|
|
38
|
+
} from '@ckeditor/ckeditor5-html-support';
|
|
39
|
+
import {
|
|
40
|
+
AutoImage,
|
|
41
|
+
Image,
|
|
42
|
+
ImageCaption,
|
|
43
|
+
ImageInsert,
|
|
44
|
+
ImageResize,
|
|
45
|
+
ImageStyle,
|
|
46
|
+
ImageToolbar,
|
|
47
|
+
ImageUpload
|
|
48
|
+
} from '@ckeditor/ckeditor5-image';
|
|
49
|
+
import { Indent, IndentBlock } from '@ckeditor/ckeditor5-indent';
|
|
50
|
+
import { TextPartLanguage } from '@ckeditor/ckeditor5-language';
|
|
51
|
+
import { AutoLink, Link, LinkImage } from '@ckeditor/ckeditor5-link';
|
|
52
|
+
import { List, ListProperties, TodoList } from '@ckeditor/ckeditor5-list';
|
|
53
|
+
// import { Markdown } from '@ckeditor/ckeditor5-markdown-gfm';
|
|
54
|
+
import { MediaEmbed } from '@ckeditor/ckeditor5-media-embed';
|
|
55
|
+
import { Mention } from '@ckeditor/ckeditor5-mention';
|
|
56
|
+
import { PageBreak } from '@ckeditor/ckeditor5-page-break';
|
|
57
|
+
import { Paragraph } from '@ckeditor/ckeditor5-paragraph';
|
|
58
|
+
import { PasteFromOffice } from '@ckeditor/ckeditor5-paste-from-office';
|
|
59
|
+
import { RemoveFormat } from '@ckeditor/ckeditor5-remove-format';
|
|
60
|
+
import { StandardEditingMode } from '@ckeditor/ckeditor5-restricted-editing';
|
|
61
|
+
import { SelectAll } from '@ckeditor/ckeditor5-select-all';
|
|
62
|
+
import { ShowBlocks } from '@ckeditor/ckeditor5-show-blocks';
|
|
63
|
+
import { SourceEditing } from '@ckeditor/ckeditor5-source-editing';
|
|
64
|
+
import {
|
|
65
|
+
SpecialCharacters,
|
|
66
|
+
SpecialCharactersArrows,
|
|
67
|
+
SpecialCharactersCurrency,
|
|
68
|
+
SpecialCharactersEssentials,
|
|
69
|
+
SpecialCharactersLatin,
|
|
70
|
+
SpecialCharactersMathematical,
|
|
71
|
+
SpecialCharactersText
|
|
72
|
+
} from '@ckeditor/ckeditor5-special-characters';
|
|
73
|
+
import { Style } from '@ckeditor/ckeditor5-style';
|
|
74
|
+
import {
|
|
75
|
+
Table,
|
|
76
|
+
TableCaption,
|
|
77
|
+
TableCellProperties,
|
|
78
|
+
TableColumnResize,
|
|
79
|
+
TableProperties,
|
|
80
|
+
TableToolbar
|
|
81
|
+
} from '@ckeditor/ckeditor5-table';
|
|
82
|
+
import { TextTransformation } from '@ckeditor/ckeditor5-typing';
|
|
83
|
+
import { EditorWatchdog } from '@ckeditor/ckeditor5-watchdog';
|
|
84
|
+
import { WordCount } from '@ckeditor/ckeditor5-word-count';
|
|
85
|
+
|
|
86
|
+
import ImportarSei from './plugins/sei';
|
|
87
|
+
import AutoTexto from './plugins/autotexto';
|
|
88
|
+
import DocumentoModelo from './plugins/modelo';
|
|
89
|
+
import SalvarComo from './plugins/salvarcomo';
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
// You can read more about extending the build with additional plugins in the "Installing plugins" guide.
|
|
93
|
+
// See https://ckeditor.com/docs/ckeditor5/latest/installation/plugins/installing-plugins.html for details.
|
|
94
|
+
|
|
95
|
+
class Editor extends DecoupledEditor {
|
|
96
|
+
public static override builtinPlugins = [
|
|
97
|
+
Alignment,
|
|
98
|
+
AutoImage,
|
|
99
|
+
AutoLink,
|
|
100
|
+
Autoformat,
|
|
101
|
+
Autosave,
|
|
102
|
+
BlockQuote,
|
|
103
|
+
Bold,
|
|
104
|
+
CloudServices,
|
|
105
|
+
Code,
|
|
106
|
+
CodeBlock,
|
|
107
|
+
DataFilter,
|
|
108
|
+
DataSchema,
|
|
109
|
+
Essentials,
|
|
110
|
+
FindAndReplace,
|
|
111
|
+
FontBackgroundColor,
|
|
112
|
+
FontColor,
|
|
113
|
+
FontFamily,
|
|
114
|
+
FontSize,
|
|
115
|
+
GeneralHtmlSupport,
|
|
116
|
+
Heading,
|
|
117
|
+
Highlight,
|
|
118
|
+
HorizontalLine,
|
|
119
|
+
HtmlComment,
|
|
120
|
+
HtmlEmbed,
|
|
121
|
+
Image,
|
|
122
|
+
ImageCaption,
|
|
123
|
+
ImageInsert,
|
|
124
|
+
ImageResize,
|
|
125
|
+
ImageStyle,
|
|
126
|
+
ImageToolbar,
|
|
127
|
+
ImageUpload,
|
|
128
|
+
Indent,
|
|
129
|
+
IndentBlock,
|
|
130
|
+
Italic,
|
|
131
|
+
Link,
|
|
132
|
+
LinkImage,
|
|
133
|
+
List,
|
|
134
|
+
ListProperties,
|
|
135
|
+
// Markdown,
|
|
136
|
+
MediaEmbed,
|
|
137
|
+
Mention,
|
|
138
|
+
PageBreak,
|
|
139
|
+
Paragraph,
|
|
140
|
+
PasteFromOffice,
|
|
141
|
+
RemoveFormat,
|
|
142
|
+
SelectAll,
|
|
143
|
+
ShowBlocks,
|
|
144
|
+
SourceEditing,
|
|
145
|
+
SpecialCharacters,
|
|
146
|
+
SpecialCharactersArrows,
|
|
147
|
+
SpecialCharactersCurrency,
|
|
148
|
+
SpecialCharactersEssentials,
|
|
149
|
+
SpecialCharactersLatin,
|
|
150
|
+
SpecialCharactersMathematical,
|
|
151
|
+
SpecialCharactersText,
|
|
152
|
+
StandardEditingMode,
|
|
153
|
+
Strikethrough,
|
|
154
|
+
Style,
|
|
155
|
+
Subscript,
|
|
156
|
+
Superscript,
|
|
157
|
+
Table,
|
|
158
|
+
TableCaption,
|
|
159
|
+
TableCellProperties,
|
|
160
|
+
TableColumnResize,
|
|
161
|
+
TableProperties,
|
|
162
|
+
TableToolbar,
|
|
163
|
+
TextPartLanguage,
|
|
164
|
+
TextTransformation,
|
|
165
|
+
TodoList,
|
|
166
|
+
Underline,
|
|
167
|
+
WordCount,
|
|
168
|
+
AutoTexto,
|
|
169
|
+
ImportarSei,
|
|
170
|
+
DocumentoModelo,
|
|
171
|
+
SalvarComo
|
|
172
|
+
];
|
|
173
|
+
|
|
174
|
+
public static override defaultConfig = {
|
|
175
|
+
toolbar: {
|
|
176
|
+
items: [
|
|
177
|
+
'undo',
|
|
178
|
+
'redo',
|
|
179
|
+
'|',
|
|
180
|
+
'fontSize',
|
|
181
|
+
'fontFamily',
|
|
182
|
+
'heading',
|
|
183
|
+
'|',
|
|
184
|
+
'fontColor',
|
|
185
|
+
'fontBackgroundColor',
|
|
186
|
+
'|',
|
|
187
|
+
'bold',
|
|
188
|
+
'italic',
|
|
189
|
+
'underline',
|
|
190
|
+
'strikethrough',
|
|
191
|
+
'subscript',
|
|
192
|
+
'superscript',
|
|
193
|
+
'|',
|
|
194
|
+
'alignment',
|
|
195
|
+
'|',
|
|
196
|
+
'numberedList',
|
|
197
|
+
'bulletedList',
|
|
198
|
+
'todoList',
|
|
199
|
+
'|',
|
|
200
|
+
'outdent',
|
|
201
|
+
'indent',
|
|
202
|
+
'|',
|
|
203
|
+
'link',
|
|
204
|
+
'blockQuote',
|
|
205
|
+
'insertTable',
|
|
206
|
+
'-',
|
|
207
|
+
'restrictedEditingException',
|
|
208
|
+
'codeBlock',
|
|
209
|
+
'findAndReplace',
|
|
210
|
+
'highlight',
|
|
211
|
+
'horizontalLine',
|
|
212
|
+
'imageInsert',
|
|
213
|
+
'pageBreak',
|
|
214
|
+
'removeFormat',
|
|
215
|
+
'selectAll',
|
|
216
|
+
'showBlocks',
|
|
217
|
+
'autotexto',
|
|
218
|
+
'importarsei',
|
|
219
|
+
'documentoModelo',
|
|
220
|
+
'salvarcomo'
|
|
221
|
+
],
|
|
222
|
+
shouldNotGroupWhenFull: true
|
|
223
|
+
},
|
|
224
|
+
language: 'pt-br',
|
|
225
|
+
image: {
|
|
226
|
+
toolbar: [
|
|
227
|
+
'imageTextAlternative',
|
|
228
|
+
'toggleImageCaption',
|
|
229
|
+
'imageStyle:inline',
|
|
230
|
+
'imageStyle:block',
|
|
231
|
+
'imageStyle:side',
|
|
232
|
+
'linkImage'
|
|
233
|
+
]
|
|
234
|
+
},
|
|
235
|
+
table: {
|
|
236
|
+
contentToolbar: [
|
|
237
|
+
'toggleTableCaption',
|
|
238
|
+
'tableColumn',
|
|
239
|
+
'tableRow',
|
|
240
|
+
'mergeTableCells',
|
|
241
|
+
'tableCellProperties',
|
|
242
|
+
'tableProperties'
|
|
243
|
+
]
|
|
244
|
+
},
|
|
245
|
+
list: {
|
|
246
|
+
properties: {
|
|
247
|
+
styles: true,
|
|
248
|
+
startIndex: true,
|
|
249
|
+
reversed: true
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export default { Editor, EditorWatchdog };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import Swal from 'sweetalert2'
|
|
3
|
+
import { Plugin } from '@ckeditor/ckeditor5-core';
|
|
4
|
+
import { ButtonView } from '@ckeditor/ckeditor5-ui';
|
|
5
|
+
import { HtmlDataProcessor } from '@ckeditor/ckeditor5-engine';
|
|
6
|
+
import $ from "jquery";
|
|
7
|
+
import 'select2/dist/js/select2.full.min'
|
|
8
|
+
import * as css from 'select2/dist/css/select2.min.css'
|
|
9
|
+
|
|
10
|
+
export default class AutoTexto extends Plugin {
|
|
11
|
+
options = [] as any
|
|
12
|
+
init() {
|
|
13
|
+
const editor = this.editor;
|
|
14
|
+
|
|
15
|
+
editor.ui.componentFactory.add( 'autotexto', () => {
|
|
16
|
+
const button = new ButtonView();
|
|
17
|
+
|
|
18
|
+
button.set( {
|
|
19
|
+
label: 'AutoTexto',
|
|
20
|
+
icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" style="padding-right: 3px;"><path d="M234.7 42.7L192 64l42.7 21.3L256 128l21.3-42.7L320 64 277.3 42.7 256 0 234.7 42.7zM384.4 192.4l-32.8-32.8L432 79.2 464.8 112l-80.4 80.4zM96 32L64 96 0 128l64 32 32 64 32-64 64-32L128 96 96 32zM416 352l-64 32 64 32 32 64 32-64 64-32-64-32-32-64-32 64zM144 512l39.6-39.6L504.4 151.6 544 112 504.4 72.4 471.6 39.6 432 0 392.4 39.6 71.6 360.4 32 400l39.6 39.6 32.8 32.8L144 512z"/></svg>',
|
|
21
|
+
withText: true,
|
|
22
|
+
tooltip: true
|
|
23
|
+
} );
|
|
24
|
+
|
|
25
|
+
//VERIFICA SE O EDITOR ESTÁ DESATIVADO
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
if(editor.isReadOnly) button.isEnabled = false
|
|
28
|
+
}, 500)
|
|
29
|
+
|
|
30
|
+
// DESABILITA O BOTÃO QUANDO O EDITOR ESTIVER DESABILITADO OU NÃO ESTIVER ATIVO
|
|
31
|
+
editor.model.document.on('change:data', () => {
|
|
32
|
+
if(editor.isReadOnly) button.isEnabled = false
|
|
33
|
+
else button.isEnabled = true
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const toolbar = editor.config.get('toolbar') as any;
|
|
37
|
+
|
|
38
|
+
if(!toolbar!.autoTextoOptions || toolbar!.autoTextoOptions === undefined || [null, undefined, ''].includes(toolbar!.autoTextoOptions)) {
|
|
39
|
+
button.isEnabled = false
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
// Execute a callback function when the button is clicked.
|
|
44
|
+
button.on( 'execute', async () => {
|
|
45
|
+
|
|
46
|
+
const toolbar = editor.config.get('toolbar') as any;
|
|
47
|
+
|
|
48
|
+
if(!toolbar!.autoTextoOptions || toolbar!.autoTextoOptions === undefined || [null, undefined, ''].includes(toolbar!.autoTextoOptions)) {
|
|
49
|
+
button.isEnabled = false
|
|
50
|
+
return Swal.fire('Erro', 'Nenhum auto texto foi encontrado', 'error')
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
this.options = toolbar!.autoTextoOptions
|
|
54
|
+
|
|
55
|
+
// if(this.options.length === 0) return Swal.fire('Erro', 'Nenhum auto texto foi encontrado', 'error')
|
|
56
|
+
|
|
57
|
+
let conteudo = await this.openModalAutoTexto() as any
|
|
58
|
+
|
|
59
|
+
if(!conteudo || ['', null, undefined].includes(conteudo)) return
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
const viewDocument = editor.editing.view.document;
|
|
63
|
+
const htmlDP = new HtmlDataProcessor( viewDocument );
|
|
64
|
+
const viewFragment = htmlDP.toView( conteudo );
|
|
65
|
+
const modelFragment = editor.data.toModel( viewFragment ) as any;
|
|
66
|
+
|
|
67
|
+
editor.model.insertContent( modelFragment );
|
|
68
|
+
|
|
69
|
+
// // Change the model using the model writer.
|
|
70
|
+
// editor.model.change( writer => {
|
|
71
|
+
|
|
72
|
+
// // Insert the text at the user's current position.
|
|
73
|
+
// editor.model.insertContent( writer.createText( modelFragment ) );
|
|
74
|
+
// } );
|
|
75
|
+
} );
|
|
76
|
+
|
|
77
|
+
return button;
|
|
78
|
+
} );
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async openModalAutoTexto(){
|
|
82
|
+
const val = await Swal.fire({
|
|
83
|
+
title: 'AutoTexto',
|
|
84
|
+
html: `
|
|
85
|
+
<div class="row w-100">
|
|
86
|
+
<div class="col-12" style="text-align: justify;">
|
|
87
|
+
<div class="form-group">
|
|
88
|
+
<select class="form-select autotextoselect">
|
|
89
|
+
</select>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
<div class="col-12 mt-5">
|
|
93
|
+
<div readonly class="form-control autotextoviewer" style="height: 200px; text-align: justify; overflow: auto;"></div>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
`,
|
|
97
|
+
willOpen: () => {
|
|
98
|
+
const self = this
|
|
99
|
+
let parametros = {
|
|
100
|
+
dropdownParent: $('.swal2-popup'),
|
|
101
|
+
placeholder: this.options?.placeholder ?? 'Selecione uma opção',
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if(this.options?.ajax) {
|
|
105
|
+
parametros['ajax'] = {
|
|
106
|
+
url: this.options?.ajax?.url ?? '',
|
|
107
|
+
method: this.options?.ajax?.method ?? 'GET',
|
|
108
|
+
dataType: this.options?.ajax?.dataType ?? 'json',
|
|
109
|
+
data: function(params) {
|
|
110
|
+
let p = {
|
|
111
|
+
search: params.term,
|
|
112
|
+
page: params.page || 1
|
|
113
|
+
}
|
|
114
|
+
if(self.options?.ajax?.data) {
|
|
115
|
+
p = {...p, ...self.options?.ajax?.data}
|
|
116
|
+
}
|
|
117
|
+
return p
|
|
118
|
+
},
|
|
119
|
+
delay: this.options?.ajax?.delay ?? 250,
|
|
120
|
+
processResults: function (data) {
|
|
121
|
+
return {
|
|
122
|
+
results: data.data.map(function(item) {
|
|
123
|
+
return {
|
|
124
|
+
id: self.options?.ajax?.results?.autotexto ? item[self.options?.ajax?.results?.autotexto] : item.autotexto,
|
|
125
|
+
text: self.options?.ajax?.results?.titulo ? item[self.options?.ajax?.results?.titulo] : item.titulo
|
|
126
|
+
}
|
|
127
|
+
}),
|
|
128
|
+
pagination: {
|
|
129
|
+
more: data.current_page < data.last_page
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
let options = this.options?.options ?? [];
|
|
136
|
+
options.unshift({id: '', text: 'Selecione uma opção'})
|
|
137
|
+
parametros['data'] = options
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
$('.autotextoselect').select2(parametros)
|
|
141
|
+
.on('change', function (e) {
|
|
142
|
+
$('.autotextoviewer').html(e.target.value)
|
|
143
|
+
})
|
|
144
|
+
},
|
|
145
|
+
showCancelButton: true,
|
|
146
|
+
confirmButtonText: 'Adicionar',
|
|
147
|
+
cancelButtonText: 'Cancelar',
|
|
148
|
+
confirmButtonColor: '#3565A0',
|
|
149
|
+
allowOutsideClick: () => !Swal.isLoading()
|
|
150
|
+
}).then((result) => {
|
|
151
|
+
if (result.isConfirmed) {
|
|
152
|
+
const autotextoviewer = document.querySelector('.autotextoviewer')
|
|
153
|
+
return autotextoviewer!.innerHTML
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
return val;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import Swal from 'sweetalert2'
|
|
3
|
+
import { Plugin } from '@ckeditor/ckeditor5-core';
|
|
4
|
+
import { ButtonView } from '@ckeditor/ckeditor5-ui';
|
|
5
|
+
import { HtmlDataProcessor } from '@ckeditor/ckeditor5-engine';
|
|
6
|
+
import $ from "jquery";
|
|
7
|
+
import 'select2/dist/js/select2.full.min'
|
|
8
|
+
import * as css from 'select2/dist/css/select2.min.css'
|
|
9
|
+
|
|
10
|
+
export default class DocumentoModelo extends Plugin {
|
|
11
|
+
options = [] as any
|
|
12
|
+
init() {
|
|
13
|
+
const editor = this.editor;
|
|
14
|
+
|
|
15
|
+
editor.ui.componentFactory.add( 'documentoModelo', () => {
|
|
16
|
+
const button = new ButtonView();
|
|
17
|
+
|
|
18
|
+
button.set( {
|
|
19
|
+
label: 'Documento Modelo',
|
|
20
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="272px" height="272px" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
|
|
21
|
+
viewBox="0 0 272 272"
|
|
22
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
23
|
+
xmlns:xodm="http://www.corel.com/coreldraw/odm/2003">
|
|
24
|
+
<defs>
|
|
25
|
+
<style type="text/css">
|
|
26
|
+
<![CDATA[
|
|
27
|
+
.fil0 {fill:#2B2A29}
|
|
28
|
+
]]>
|
|
29
|
+
</style>
|
|
30
|
+
</defs>
|
|
31
|
+
<g id="Layer_x0020_1">
|
|
32
|
+
<metadata id="CorelCorpID_0Corel-Layer"/>
|
|
33
|
+
<g id="_1428326992">
|
|
34
|
+
<g>
|
|
35
|
+
<path class="fil0" d="M30.17 65.9l135.94 0 0.41 153.88c0,5.7 0.65,17.26 -0.19,22.27l-136.38 0.19c-0.78,-4.84 -0.15,-147.92 -0.2,-170.71 0,-1.89 -0.27,-4.13 0.42,-5.63zm75.05 -33.21c3.8,1.33 9.7,4.77 13.18,6.6 4.35,2.3 8.21,4.23 12.42,6.55l24.51 13.11c0.06,-0.1 0.22,0.17 0.32,0.33l-50.37 0 -0.06 -26.59zm67.75 26.86c-1.83,-0.61 -2.07,-0.17 -4.2,-1.25l-24.81 -13.11c-4.68,-2.32 -10.06,-5.17 -14.47,-7.5l-13.57 -7.41 125.79 0.13 0.01 176.01 -68.65 -0.12 -0.1 -146.75zm-149.66 189.19l149.76 0 -0.01 -35.61 75.12 -0.07 0.16 -189.45 -149.75 0 0.06 35.67 -75.34 -0.02 0 189.48z"/>
|
|
36
|
+
<path class="fil0" d="M67.62 119.88c3.08,-5.42 4.67,-11.58 9.22,-10.08 1.94,0.63 3.15,3.52 4.37,5.63l18.57 31.34c2.05,3.53 6.13,9.53 7.35,12.82l-60.57 0.01 21.06 -39.72zm47.49 39.55c-1.89,-2.46 -3.36,-5.38 -4.94,-8.08 -2.81,-4.82 -2.3,-3.21 0.31,-8.07 2.74,-5.11 6.73,-15.22 13.07,-10.31 2.54,1.97 6.02,6.28 9.66,9.82l12.09 13.37c1.96,1.81 1.85,0.95 2.97,3.43l-33.16 -0.16zm-70.43 -68.96l107.45 0 -0.14 62.79c-1.29,-1.17 -1.8,-1.43 -2.97,-2.82 -0.94,-1.11 -1.56,-1.9 -2.5,-3l-16.77 -17.66c-2.09,-2.21 -3.17,-3.63 -7.01,-4.37 -12.4,-2.39 -14.78,11.11 -18.61,15.22l-0.76 -0.92c-0.3,-0.4 -0.15,-0.18 -0.44,-0.62 -0.23,-0.35 -0.51,-0.85 -0.74,-1.25l-5 -8.46c-2.22,-3.72 -4.27,-7.07 -6.51,-10.97 -4.04,-7.04 -8.6,-19.06 -19.31,-14.72 -4,1.62 -5.74,6.01 -7.93,10.02l-12.38 23.05c-1.23,2.22 -1.91,3.72 -3.12,5.87l-2.77 4.83c-0.05,0.08 -0.23,0.39 -0.27,0.31 -0.04,-0.09 -0.18,0.21 -0.23,0.3l0.01 -57.6zm113.7 -6.6l-120.14 -0.02 0.16 82.17 119.89 0 0.05 -0.65 0.04 -81.5z"/>
|
|
37
|
+
<path class="fil0" d="M190.85 105.66l35.08 0 0.17 34.39 -35.23 -0.08 -0.02 -34.31zm41.56 -6.81l-47.91 0 -0.01 47.56 48.05 -0.16 -0.13 -47.4z"/>
|
|
38
|
+
<path class="fil0" d="M225.74 47.64c0.77,0.71 0.81,-1.32 0.69,1.43l-0.22 35.72c-3.24,1.16 -40.75,0.42 -47.25,0.42l0.04 5.79 53.41 0 -0.2 -50.01 -72.31 -0.04 0 6.76 65.84 -0.07z"/>
|
|
39
|
+
<path class="fil0" d="M126.7 108.97c-0.35,-7.33 10.5,-7.7 11.07,-0.99 0.65,7.57 -10.74,7.94 -11.07,0.99zm5.45 -12.66c-17.46,1.08 -14.73,25.52 0.95,24.42 6.45,-0.45 11.93,-6.25 11.31,-13.2 -0.53,-5.95 -5.67,-11.63 -12.26,-11.22z"/>
|
|
40
|
+
<polygon class="fil0" points="37.75,197.42 40.24,197.47 89.15,197.46 91.29,197.5 91.29,190.75 37.75,190.75 "/>
|
|
41
|
+
<polygon class="fil0" points="104.61,193.83 104.6,194.33 104.61,197.46 158.18,197.46 158.16,190.75 104.63,190.75 "/>
|
|
42
|
+
<polygon class="fil0" points="37.76,211.75 91.21,211.75 91.3,209.8 91.29,205.06 37.75,205.06 "/>
|
|
43
|
+
<polygon class="fil0" points="104.6,211.74 158.05,211.75 158.06,205.07 104.63,205.09 "/>
|
|
44
|
+
<polygon class="fil0" points="37.74,225.93 91.33,225.96 91.27,219.29 37.79,219.29 "/>
|
|
45
|
+
<polygon class="fil0" points="37.77,183.18 91.15,183.17 91.23,176.56 37.9,176.57 "/>
|
|
46
|
+
<polygon class="fil0" points="104.63,183.18 157.99,183.17 158.11,176.56 104.79,176.57 "/>
|
|
47
|
+
<polygon class="fil0" points="183.94,160.02 233,160.07 233,153.37 183.93,153.37 "/>
|
|
48
|
+
<polygon class="fil0" points="184.28,185.55 232.9,185.58 232.97,178.86 183.91,178.91 "/>
|
|
49
|
+
<polygon class="fil0" points="184.04,172.79 233.01,172.81 232.75,166.13 184.02,166.15 "/>
|
|
50
|
+
<polygon class="fil0" points="104.58,225.96 140.25,225.96 140.25,219.26 104.68,219.3 "/>
|
|
51
|
+
<polygon class="fil0" points="183.99,198.37 214.25,198.4 214.25,191.65 183.94,191.68 "/>
|
|
52
|
+
<path class="fil0" d="M166.11 65.9l0.03 175.95 -135.97 0.14 0 -176.09c-0.69,1.5 -0.42,3.74 -0.42,5.63 0.05,22.79 -0.58,165.87 0.2,170.71l136.38 -0.19c0.84,-5.01 0.19,-16.57 0.19,-22.27l-0.41 -153.88z"/>
|
|
53
|
+
<path class="fil0" d="M158.38 83.87l-0.04 81.5 -0.05 0.65 -119.89 0 -0.16 -82.17 -0.38 41.09c0,8.03 -0.39,35.57 0.11,41.23 2.57,0.67 118.39,0.64 120.82,0 0.93,-13.17 0.08,-45.14 0.08,-61.69l-0.49 -20.61z"/>
|
|
54
|
+
<path class="fil0" d="M225.74 47.64l0.32 37 -47.53 0.07 0.1 6.73 54.26 -0.14 0 -48.72c-0.07,-2.74 0.06,-0.77 -0.68,-1.59l0.2 50.01 -53.41 0 -0.04 -5.79c6.5,0 44.01,0.74 47.25,-0.42l0.22 -35.72c0.12,-2.75 0.08,-0.72 -0.69,-1.43z"/>
|
|
55
|
+
<path class="fil0" d="M232.41 98.85l0.13 47.4 -48.05 0.16 0.01 -47.56c-0.8,1.66 -0.44,4.01 -0.44,6.13 0.01,8.4 -0.47,38.05 0.19,41.78l48.46 -0.1c0.89,-3.7 0.27,-19.28 0.27,-24.21 0,-2.25 0.65,-21.6 -0.57,-23.6z"/>
|
|
56
|
+
</g>
|
|
57
|
+
</g>
|
|
58
|
+
</g>
|
|
59
|
+
</svg>`,
|
|
60
|
+
withText: true,
|
|
61
|
+
tooltip: true
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
//VERIFICA SE O EDITOR ESTÁ DESATIVADO
|
|
65
|
+
setTimeout(() => {
|
|
66
|
+
if(editor.isReadOnly) button.isEnabled = false
|
|
67
|
+
}, 500)
|
|
68
|
+
|
|
69
|
+
// DESABILITA O BOTÃO QUANDO O EDITOR ESTIVER DESABILITADO OU NÃO ESTIVER ATIVO
|
|
70
|
+
editor.model.document.on('change:data', () => {
|
|
71
|
+
if(editor.isReadOnly) button.isEnabled = false
|
|
72
|
+
else button.isEnabled = true
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
const toolbar = editor.config.get('toolbar') as any;
|
|
76
|
+
|
|
77
|
+
if(!toolbar!.documentoModeloOptions || toolbar!.documentoModeloOptions === undefined || [null, undefined, ''].includes(toolbar!.documentoModeloOptions)) {
|
|
78
|
+
button.isEnabled = false
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
// Execute a callback function when the button is clicked.
|
|
83
|
+
button.on( 'execute', async () => {
|
|
84
|
+
|
|
85
|
+
const toolbar = editor.config.get('toolbar') as any;
|
|
86
|
+
|
|
87
|
+
if(!toolbar!.documentoModeloOptions || toolbar!.documentoModeloOptions === undefined || [null, undefined, ''].includes(toolbar!.documentoModeloOptions)) {
|
|
88
|
+
button.isEnabled = false
|
|
89
|
+
return Swal.fire('Erro', 'Nenhum modelo foi encontrado', 'error')
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
this.options = toolbar!.documentoModeloOptions
|
|
93
|
+
|
|
94
|
+
let conteudo = await this.openModalDocumentoModelo() as any
|
|
95
|
+
|
|
96
|
+
if(!conteudo || ['', null, undefined].includes(conteudo)) return
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
const viewDocument = editor.editing.view.document;
|
|
100
|
+
const htmlDP = new HtmlDataProcessor( viewDocument );
|
|
101
|
+
const viewFragment = htmlDP.toView( conteudo );
|
|
102
|
+
const modelFragment = editor.data.toModel( viewFragment ) as any;
|
|
103
|
+
|
|
104
|
+
editor.model.insertContent( modelFragment );
|
|
105
|
+
} );
|
|
106
|
+
|
|
107
|
+
return button;
|
|
108
|
+
} );
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async openModalDocumentoModelo(){
|
|
112
|
+
const val = await Swal.fire({
|
|
113
|
+
title: 'Modelo de Documento',
|
|
114
|
+
html: `
|
|
115
|
+
<div class="row w-100">
|
|
116
|
+
${(this.options.categoria) ? `<div class="col-12 mb-3" style="text-align: justify;">
|
|
117
|
+
<div class="form-group">
|
|
118
|
+
<select class="form-select categoriamodeloselect">
|
|
119
|
+
</select>
|
|
120
|
+
</div>
|
|
121
|
+
</div>` : ''}
|
|
122
|
+
<div class="col-12" style="text-align: justify;">
|
|
123
|
+
<div class="form-group">
|
|
124
|
+
<select class="form-select documentomodeloselect">
|
|
125
|
+
</select>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
<div class="col-12 mt-5">
|
|
129
|
+
<div readonly class="form-control documentomodeloviewer" style="height: 200px; text-align: justify; overflow: auto;"></div>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
`,
|
|
133
|
+
willOpen: () => {
|
|
134
|
+
|
|
135
|
+
$('.categoriamodeloselect')
|
|
136
|
+
.select2(this.parametrosDocumentoModeloCategoria())
|
|
137
|
+
|
|
138
|
+
$('.documentomodeloselect')
|
|
139
|
+
.select2(this.parametrosDocumentoModelo())
|
|
140
|
+
.on('change', function (e) {
|
|
141
|
+
$('.documentomodeloviewer').html(e.target.value)
|
|
142
|
+
})
|
|
143
|
+
},
|
|
144
|
+
showCancelButton: true,
|
|
145
|
+
confirmButtonText: 'Adicionar',
|
|
146
|
+
cancelButtonText: 'Cancelar',
|
|
147
|
+
confirmButtonColor: '#3565A0',
|
|
148
|
+
allowOutsideClick: () => !Swal.isLoading()
|
|
149
|
+
}).then((result) => {
|
|
150
|
+
if (result.isConfirmed) {
|
|
151
|
+
const documentomodeloviewer = document.querySelector('.documentomodeloviewer')
|
|
152
|
+
return documentomodeloviewer!.innerHTML
|
|
153
|
+
}
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
return val;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
parametrosDocumentoModeloCategoria() {
|
|
160
|
+
const self = this
|
|
161
|
+
let parametros = {
|
|
162
|
+
dropdownParent: $('.swal2-popup'),
|
|
163
|
+
placeholder: this.options?.categoria?.placeholder ?? 'Selecione uma categoria',
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if(this.options?.categoria?.ajax) {
|
|
167
|
+
parametros['ajax'] = {
|
|
168
|
+
url: this.options?.categoria?.ajax?.url ?? '',
|
|
169
|
+
method: this.options?.categoria?.ajax?.method ?? 'GET',
|
|
170
|
+
dataType: this.options?.categoria?.ajax?.dataType ?? 'json',
|
|
171
|
+
data: function(params) {
|
|
172
|
+
let p = {
|
|
173
|
+
search: params.term,
|
|
174
|
+
page: params.page || 1
|
|
175
|
+
}
|
|
176
|
+
if(self.options?.categoria?.ajax?.data) {
|
|
177
|
+
p = {...p, ...self.options?.categoria?.ajax?.data}
|
|
178
|
+
}
|
|
179
|
+
return p
|
|
180
|
+
},
|
|
181
|
+
delay: this.options?.categoria?.ajax?.delay ?? 250,
|
|
182
|
+
processResults: function (data) {
|
|
183
|
+
return {
|
|
184
|
+
results: data.data.map(function(item) {
|
|
185
|
+
return {
|
|
186
|
+
id: self.options?.categoria?.ajax?.results?.id ? item[self.options?.categoria?.ajax?.results?.id] : item.id,
|
|
187
|
+
text: self.options?.categoria?.ajax?.results?.value ? item[self.options?.categoria?.ajax?.results?.value] : item.value
|
|
188
|
+
}
|
|
189
|
+
}),
|
|
190
|
+
pagination: {
|
|
191
|
+
more: data.current_page < data.last_page
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
} else {
|
|
197
|
+
let options = this.options?.categoria?.options ?? [];
|
|
198
|
+
options.unshift({id: '', text: 'Selecione uma opção'})
|
|
199
|
+
parametros['data'] = options
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return parametros;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
parametrosDocumentoModelo() {
|
|
206
|
+
const self = this
|
|
207
|
+
let parametros = {
|
|
208
|
+
dropdownParent: $('.swal2-popup'),
|
|
209
|
+
placeholder: this.options?.placeholder ?? 'Selecione uma opção',
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if(this.options?.ajax) {
|
|
213
|
+
parametros['ajax'] = {
|
|
214
|
+
url: this.options?.ajax?.url ?? '',
|
|
215
|
+
method: this.options?.ajax?.method ?? 'GET',
|
|
216
|
+
dataType: this.options?.ajax?.dataType ?? 'json',
|
|
217
|
+
data: function(params) {
|
|
218
|
+
let p = {
|
|
219
|
+
search: params.term,
|
|
220
|
+
page: params.page || 1,
|
|
221
|
+
categoria: $('.categoriamodeloselect').val() ?? null,
|
|
222
|
+
}
|
|
223
|
+
if(self.options?.ajax?.data) {
|
|
224
|
+
p = {...p, ...self.options?.ajax?.data}
|
|
225
|
+
}
|
|
226
|
+
return p
|
|
227
|
+
},
|
|
228
|
+
delay: this.options?.ajax?.delay ?? 250,
|
|
229
|
+
processResults: function (data) {
|
|
230
|
+
return {
|
|
231
|
+
results: data.data.map(function(item) {
|
|
232
|
+
return {
|
|
233
|
+
id: self.options?.ajax?.results?.autotexto ? item[self.options?.ajax?.results?.autotexto] : item.autotexto,
|
|
234
|
+
text: self.options?.ajax?.results?.titulo ? item[self.options?.ajax?.results?.titulo] : item.titulo
|
|
235
|
+
}
|
|
236
|
+
}),
|
|
237
|
+
pagination: {
|
|
238
|
+
more: data.current_page < data.last_page
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
} else {
|
|
244
|
+
let options = this.options?.options ?? [];
|
|
245
|
+
options.unshift({id: '', text: 'Selecione uma opção'})
|
|
246
|
+
parametros['data'] = options
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return parametros;
|
|
250
|
+
}
|
|
251
|
+
}
|