Skip to content

Commit 536c12e

Browse files
committed
Add missing editingDowncast to cite plugin, update webpack-cli to ^6.0.1
1 parent ae4fe68 commit 536c12e

File tree

9 files changed

+1192
-793
lines changed

9 files changed

+1192
-793
lines changed

modules/custom/wxt_ext/wxt_ext_editor/css/wxt_ext_editor.admin.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
display: block !important;
2727
}
2828

29-
.ck-content cite.ck-editor__editable {
29+
.ck-content cite {
3030
background: #efefef;
3131
border: 1px dotted #333 !important;
3232
}

modules/custom/wxt_ext/wxt_ext_editor/js/build/cite.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ module.exports = CKEditor5.dll;
8686
/******/
8787
/************************************************************************/
8888
var __webpack_exports__ = {};
89-
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
89+
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
9090
(() => {
9191
"use strict";
9292

@@ -101,9 +101,9 @@ var delegated_corefrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/
101101
var delegated_uifrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/src/ui.js");
102102
// EXTERNAL MODULE: delegated ./widget.js from dll-reference CKEditor5.dll
103103
var delegated_widgetfrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/src/widget.js");
104-
;// CONCATENATED MODULE: ./icons/cite.svg
104+
;// ./icons/cite.svg
105105
/* harmony default export */ const cite = ("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M0 1v16.981h4v5.019l7-5.019h13v-16.981h-24zm12 8.028c0 2.337-1.529 3.91-3.684 4.335l-.406-.87c.996-.375 1.637-1.587 1.637-2.493h-1.547v-4h4v3.028zm5 0c0 2.337-1.529 3.91-3.684 4.335l-.406-.87c.996-.375 1.637-1.587 1.637-2.493h-1.547v-4h4v3.028z\"/></svg>");
106-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/cite/src/cite.js
106+
;// ./js/ckeditor5_plugins/cite/src/cite.js
107107

108108

109109

@@ -216,22 +216,36 @@ class CitePlugin extends delegated_corefrom_dll_reference_CKEditor5.Plugin {
216216

217217
// Upcast <cite> elements from raw HTML into model data.
218218
conversion.for('upcast').elementToElement({
219-
model: 'cite',
220-
view: 'cite'
219+
view: 'cite',
220+
model: (viewElement, { writer }) => {
221+
// If the cite is already inside another cite, unwrap it.
222+
if (viewElement.parent && viewElement.parent.name === 'cite') {
223+
return null;
224+
}
225+
return writer.createElement('cite');
226+
},
221227
});
222228

223229
// Downcast model data into <cite> elements for editing and data output.
224230
conversion.for('downcast').elementToElement({
225231
model: 'cite',
226232
view: (modelElement, { writer }) => {
227-
const citeElement = writer.createContainerElement('cite');
233+
return writer.createContainerElement('cite');
234+
}
235+
});
236+
237+
// Downcast for editing mode (Ensures it's editable but doesn't add attributes)
238+
conversion.for('editingDowncast').elementToElement({
239+
model: 'cite',
240+
view: (modelElement, { writer }) => {
241+
const citeElement = writer.createEditableElement('cite');
228242
return (0,delegated_widgetfrom_dll_reference_CKEditor5.toWidgetEditable)(citeElement, writer);
229243
}
230244
});
231245
}
232246
}
233247

234-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/cite/src/index.js
248+
;// ./js/ckeditor5_plugins/cite/src/index.js
235249

236250

237251
/* harmony default export */ const src = ({

modules/custom/wxt_ext/wxt_ext_editor/js/build/wxt_alert.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ module.exports = CKEditor5.dll;
9393
/******/
9494
/************************************************************************/
9595
var __webpack_exports__ = {};
96-
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
96+
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
9797
(() => {
9898
"use strict";
9999

@@ -106,14 +106,14 @@ __webpack_require__.d(__webpack_exports__, {
106106
var delegated_corefrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/src/core.js");
107107
// EXTERNAL MODULE: delegated ./widget.js from dll-reference CKEditor5.dll
108108
var delegated_widgetfrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/src/widget.js");
109-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_alert/src/alertcssclasses.js
109+
;// ./js/ckeditor5_plugins/wxt_alert/src/alertcssclasses.js
110110
const AlertClasses = [
111111
'info',
112112
'success',
113113
'danger',
114114
'warning'
115115
];
116-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_alert/src/insertalertcommand.js
116+
;// ./js/ckeditor5_plugins/wxt_alert/src/insertalertcommand.js
117117

118118

119119

@@ -230,7 +230,7 @@ function getAlertTemplate(writer, alertClass, headingLevel) {
230230
return alert;
231231
}
232232

233-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_alert/src/alertediting.js
233+
;// ./js/ckeditor5_plugins/wxt_alert/src/alertediting.js
234234

235235

236236

@@ -374,7 +374,7 @@ class AlertEditing extends delegated_corefrom_dll_reference_CKEditor5.Plugin {
374374
var delegated_uifrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/src/ui.js");
375375
// EXTERNAL MODULE: delegated ./utils.js from dll-reference CKEditor5.dll
376376
var delegated_utilsfrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/src/utils.js");
377-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_alert/src/alertview.js
377+
;// ./js/ckeditor5_plugins/wxt_alert/src/alertview.js
378378

379379

380380

@@ -496,9 +496,9 @@ class FormView extends delegated_uifrom_dll_reference_CKEditor5.View {
496496
}
497497
}
498498

499-
;// CONCATENATED MODULE: ./icons/alert.svg
499+
;// ./icons/alert.svg
500500
/* harmony default export */ const icons_alert = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?><svg id=\"Layer_2\" xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"28\" viewBox=\"0 0 32 28\"><g id=\"Layer_1-2\"><path id=\"alert\" d=\"m31.75,25.22L17.61.92c-.72-1.23-2.51-1.23-3.23,0L.25,25.22c-.72,1.23.18,2.78,1.61,2.78h28.27c1.43,0,2.33-1.54,1.61-2.78Zm-15.75.81c-1.33,0-2.35-1.01-2.35-2.27s1.02-2.33,2.35-2.33,2.35,1.04,2.35,2.33-1.05,2.27-2.35,2.27Zm2.66-17.16l-.96,9.98c-.04.51-.52.73-1.4.73h-.61c-.87,0-1.35-.23-1.4-.73l-.96-9.98v-.63c0-.51.52-.78,1.35-.78h2.62c.83,0,1.35.28,1.35.78v.63Z\" stroke-width=\"0\"/></g></svg>");
501-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_alert/src/alertui.js
501+
;// ./js/ckeditor5_plugins/wxt_alert/src/alertui.js
502502

503503

504504

@@ -655,7 +655,7 @@ class AlertUI extends delegated_corefrom_dll_reference_CKEditor5.Plugin {
655655
}
656656
}
657657

658-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_alert/src/alert.js
658+
;// ./js/ckeditor5_plugins/wxt_alert/src/alert.js
659659

660660

661661

@@ -665,7 +665,7 @@ class Alert extends delegated_corefrom_dll_reference_CKEditor5.Plugin {
665665
return [AlertEditing, AlertUI];
666666
}
667667
}
668-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_alert/src/index.js
668+
;// ./js/ckeditor5_plugins/wxt_alert/src/index.js
669669
/**
670670
* @file The build process always expects an index.js file. Anything exported
671671
* here will be recognized by CKEditor 5 as an available plugin. Multiple

modules/custom/wxt_ext/wxt_ext_editor/js/build/wxt_conjunctions.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ module.exports = CKEditor5.dll;
9393
/******/
9494
/************************************************************************/
9595
var __webpack_exports__ = {};
96-
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
96+
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
9797
(() => {
9898
"use strict";
9999

@@ -106,13 +106,13 @@ __webpack_require__.d(__webpack_exports__, {
106106
var delegated_corefrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/src/core.js");
107107
// EXTERNAL MODULE: delegated ./widget.js from dll-reference CKEditor5.dll
108108
var delegated_widgetfrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/src/widget.js");
109-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_conjunctions/src/conjunctioncssclasses.js
109+
;// ./js/ckeditor5_plugins/wxt_conjunctions/src/conjunctioncssclasses.js
110110
const ConjunctionClasses = [
111111
'and',
112112
'or'
113113
];
114114

115-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_conjunctions/src/insertconjunctioncommand.js
115+
;// ./js/ckeditor5_plugins/wxt_conjunctions/src/insertconjunctioncommand.js
116116

117117

118118
class InsertConjunctionCommand extends delegated_corefrom_dll_reference_CKEditor5.Command {
@@ -211,7 +211,7 @@ class InsertConjunctionCommand extends delegated_corefrom_dll_reference_CKEditor
211211
}
212212
}
213213

214-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_conjunctions/src/conjunctionediting.js
214+
;// ./js/ckeditor5_plugins/wxt_conjunctions/src/conjunctionediting.js
215215

216216

217217

@@ -434,7 +434,7 @@ class ConjunctionEditing extends delegated_corefrom_dll_reference_CKEditor5.Plug
434434

435435
// EXTERNAL MODULE: delegated ./ui.js from dll-reference CKEditor5.dll
436436
var delegated_uifrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/src/ui.js");
437-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_conjunctions/src/responsiveclasses.js
437+
;// ./js/ckeditor5_plugins/wxt_conjunctions/src/responsiveclasses.js
438438
const ResponsiveClasses = [
439439
'cnjnctn-xs',
440440
'cnjnctn-sm',
@@ -444,7 +444,7 @@ const ResponsiveClasses = [
444444

445445
// EXTERNAL MODULE: delegated ./utils.js from dll-reference CKEditor5.dll
446446
var delegated_utilsfrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/src/utils.js");
447-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_conjunctions/src/conjunctionview.js
447+
;// ./js/ckeditor5_plugins/wxt_conjunctions/src/conjunctionview.js
448448

449449

450450

@@ -635,9 +635,9 @@ class FormView extends delegated_uifrom_dll_reference_CKEditor5.View {
635635
}
636636
}
637637

638-
;// CONCATENATED MODULE: ./icons/conjunction.svg
638+
;// ./icons/conjunction.svg
639639
/* harmony default export */ const conjunction = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg id=\"Layer_1\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\">\n <g>\n <path d=\"M18,11c-.55,0-1,.51-1,1.14v5.71c0,.63.45,1.14,1,1.14s1-.51,1-1.14v-5.71c0-.63-.45-1.14-1-1.14Z\"/>\n <path d=\"M14,11c-.55,0-1,.51-1,1.14v5.71c0,.63.45,1.14,1,1.14s1-.51,1-1.14v-5.71c0-.63-.45-1.14-1-1.14Z\"/>\n </g>\n <path d=\"M3.64,17.36c-.26,0-.51-.1-.71-.29-.39-.39-.39-1.02,0-1.41L15.66,2.93c.39-.39,1.02-.39,1.41,0s.39,1.02,0,1.41l-12.73,12.73c-.2.2-.45.29-.71.29Z\"/>\n <path d=\"M8,4h-2v-2c0-.55-.45-1-1-1s-1,.45-1,1v2h-2c-.55,0-1,.45-1,1s.45,1,1,1h2v2c0,.55.45,1,1,1s1-.45,1-1v-2h2c.55,0,1-.45,1-1s-.45-1-1-1Z\"/>\n</svg>");
640-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_conjunctions/src/conjunctionui.js
640+
;// ./js/ckeditor5_plugins/wxt_conjunctions/src/conjunctionui.js
641641

642642

643643

@@ -780,7 +780,7 @@ class ConjunctionUI extends delegated_corefrom_dll_reference_CKEditor5.Plugin {
780780

781781
}
782782

783-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_conjunctions/src/conjunctions.js
783+
;// ./js/ckeditor5_plugins/wxt_conjunctions/src/conjunctions.js
784784

785785

786786

@@ -790,7 +790,7 @@ class Conjunction extends delegated_corefrom_dll_reference_CKEditor5.Plugin {
790790
return [ConjunctionEditing, ConjunctionUI];
791791
}
792792
}
793-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_conjunctions/src/index.js
793+
;// ./js/ckeditor5_plugins/wxt_conjunctions/src/index.js
794794

795795

796796
/* harmony default export */ const src = ({

modules/custom/wxt_ext/wxt_ext_editor/js/build/wxt_panel.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ module.exports = CKEditor5.dll;
9393
/******/
9494
/************************************************************************/
9595
var __webpack_exports__ = {};
96-
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
96+
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
9797
(() => {
9898
"use strict";
9999

@@ -106,7 +106,7 @@ __webpack_require__.d(__webpack_exports__, {
106106
var delegated_corefrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/src/core.js");
107107
// EXTERNAL MODULE: delegated ./widget.js from dll-reference CKEditor5.dll
108108
var delegated_widgetfrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/src/widget.js");
109-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_panel/src/panelcssclasses.js
109+
;// ./js/ckeditor5_plugins/wxt_panel/src/panelcssclasses.js
110110
const PanelClasses = [
111111
'primary',
112112
'default',
@@ -116,7 +116,7 @@ const PanelClasses = [
116116
'danger',
117117
'warning'
118118
];
119-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_panel/src/insertpanelcommand.js
119+
;// ./js/ckeditor5_plugins/wxt_panel/src/insertpanelcommand.js
120120

121121

122122

@@ -236,7 +236,7 @@ function getPanelTemplate(writer, panelClass) {
236236

237237
return panel;
238238
}
239-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_panel/src/panelediting.js
239+
;// ./js/ckeditor5_plugins/wxt_panel/src/panelediting.js
240240

241241

242242

@@ -425,7 +425,7 @@ class PanelEditing extends delegated_corefrom_dll_reference_CKEditor5.Plugin {
425425
var delegated_uifrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/src/ui.js");
426426
// EXTERNAL MODULE: delegated ./utils.js from dll-reference CKEditor5.dll
427427
var delegated_utilsfrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/src/utils.js");
428-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_panel/src/panelview.js
428+
;// ./js/ckeditor5_plugins/wxt_panel/src/panelview.js
429429

430430

431431

@@ -517,9 +517,9 @@ class FormView extends delegated_uifrom_dll_reference_CKEditor5.View {
517517
return button;
518518
}
519519
}
520-
;// CONCATENATED MODULE: ./icons/panel.svg
520+
;// ./icons/panel.svg
521521
/* harmony default export */ const panel = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?><svg id=\"Layer_2\" xmlns=\"http://www.w3.org/2000/svg\" width=\"50\" height=\"30\" viewBox=\"0 0 50 30\"><g id=\"Layer_1-2\"><path id=\"panel\" d=\"m0,0v30h50V0H0Zm2.98,2.93h19.52v4.56H2.98V2.93Zm44.04,24.29H2.98V10.49h44.04v16.73Z\" stroke-width=\"0\"/></g></svg>");
522-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_panel/src/panelui.js
522+
;// ./js/ckeditor5_plugins/wxt_panel/src/panelui.js
523523

524524

525525

@@ -649,7 +649,7 @@ class PanelUI extends delegated_corefrom_dll_reference_CKEditor5.Plugin {
649649
};
650650
}
651651
}
652-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_panel/src/panel.js
652+
;// ./js/ckeditor5_plugins/wxt_panel/src/panel.js
653653

654654

655655

@@ -659,7 +659,7 @@ class Panel extends delegated_corefrom_dll_reference_CKEditor5.Plugin {
659659
return [PanelEditing, PanelUI];
660660
}
661661
}
662-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_panel/src/index.js
662+
;// ./js/ckeditor5_plugins/wxt_panel/src/index.js
663663

664664

665665
/* harmony default export */ const src = ({

modules/custom/wxt_ext/wxt_ext_editor/js/build/wxt_tabs.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ module.exports = CKEditor5.dll;
8686
/******/
8787
/************************************************************************/
8888
var __webpack_exports__ = {};
89-
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
89+
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
9090
(() => {
9191
"use strict";
9292

@@ -99,7 +99,7 @@ __webpack_require__.d(__webpack_exports__, {
9999
var delegated_corefrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/src/core.js");
100100
// EXTERNAL MODULE: delegated ./widget.js from dll-reference CKEditor5.dll
101101
var delegated_widgetfrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/src/widget.js");
102-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_tabs/src/insertwxttabcommand.js
102+
;// ./js/ckeditor5_plugins/wxt_tabs/src/insertwxttabcommand.js
103103

104104

105105
class InsertWXTTabsCommand extends delegated_corefrom_dll_reference_CKEditor5.Command {
@@ -131,7 +131,7 @@ class InsertWXTTabsCommand extends delegated_corefrom_dll_reference_CKEditor5.Co
131131
}
132132
}
133133

134-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_tabs/src/wxttabediting.js
134+
;// ./js/ckeditor5_plugins/wxt_tabs/src/wxttabediting.js
135135

136136

137137

@@ -278,9 +278,9 @@ class WXTTabsEditing extends delegated_corefrom_dll_reference_CKEditor5.Plugin {
278278

279279
// EXTERNAL MODULE: delegated ./ui.js from dll-reference CKEditor5.dll
280280
var delegated_uifrom_dll_reference_CKEditor5 = __webpack_require__("ckeditor5/src/ui.js");
281-
;// CONCATENATED MODULE: ./icons/tab.svg
281+
;// ./icons/tab.svg
282282
/* harmony default export */ const tab = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg id=\"Layer_1\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\">\n <defs>\n <style>\n .cls-1 {\n fill: #666;\n }\n </style>\n </defs>\n <path class=\"cls-1\" d=\"M17.5,3.2v2.47h-1v-2.17h-6.52v-1h6.73c.44,0,.79.31.79.7Z\"/>\n <path d=\"M19.21,6.17v11.81c0,.28-.22.5-.5.5s-.5-.22-.5-.5V6.67h-8.73c-.27,0-.5-.23-.5-.5v-3.67H1.95v3.67c0,.25-.2.47-.45.49v11.32c0,.28-.22.5-.5.5s-.5-.22-.5-.5V6.17c0-.26.2-.47.45-.5v-3.37c0-.44.35-.8.8-.8h7.43c.44,0,.8.36.8.8v3.37h8.73c.28,0,.5.22.5.5Z\"/>\n <path d=\"M15.5,15.49H4.51c-.28,0-.5-.22-.5-.5s.22-.5.5-.5h10.99c.28,0,.5.22.5.5s-.22.5-.5.5Z\"/>\n <path d=\"M15.5,11.49H4.51c-.28,0-.5-.22-.5-.5s.22-.5.5-.5h10.99c.28,0,.5.22.5.5s-.22.5-.5.5Z\"/>\n</svg>");
283-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_tabs/src/wxttabui.js
283+
;// ./js/ckeditor5_plugins/wxt_tabs/src/wxttabui.js
284284

285285

286286

@@ -309,7 +309,7 @@ class WXTTabsUI extends delegated_corefrom_dll_reference_CKEditor5.Plugin {
309309
}
310310
}
311311

312-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_tabs/src/tabs.js
312+
;// ./js/ckeditor5_plugins/wxt_tabs/src/tabs.js
313313

314314

315315

@@ -320,7 +320,7 @@ class WXTTabs extends delegated_corefrom_dll_reference_CKEditor5.Plugin {
320320
}
321321
}
322322

323-
;// CONCATENATED MODULE: ./js/ckeditor5_plugins/wxt_tabs/src/index.js
323+
;// ./js/ckeditor5_plugins/wxt_tabs/src/index.js
324324

325325

326326
/* harmony default export */ const src = ({

modules/custom/wxt_ext/wxt_ext_editor/js/ckeditor5_plugins/cite/src/cite.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,29 @@ export default class CitePlugin extends Plugin {
110110

111111
// Upcast <cite> elements from raw HTML into model data.
112112
conversion.for('upcast').elementToElement({
113-
model: 'cite',
114-
view: 'cite'
113+
view: 'cite',
114+
model: (viewElement, { writer }) => {
115+
// If the cite is already inside another cite, unwrap it.
116+
if (viewElement.parent && viewElement.parent.name === 'cite') {
117+
return null;
118+
}
119+
return writer.createElement('cite');
120+
},
115121
});
116122

117123
// Downcast model data into <cite> elements for editing and data output.
118124
conversion.for('downcast').elementToElement({
119125
model: 'cite',
120126
view: (modelElement, { writer }) => {
121-
const citeElement = writer.createContainerElement('cite');
127+
return writer.createContainerElement('cite');
128+
}
129+
});
130+
131+
// Downcast for editing mode (Ensures it's editable but doesn't add attributes)
132+
conversion.for('editingDowncast').elementToElement({
133+
model: 'cite',
134+
view: (modelElement, { writer }) => {
135+
const citeElement = writer.createEditableElement('cite');
122136
return toWidgetEditable(citeElement, writer);
123137
}
124138
});

0 commit comments

Comments
 (0)