@licium/editor-plugin-details 1.0.2 → 1.0.13

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,683 @@
1
+ /*!
2
+ * TOAST UI Editor : Text Align Plugin
3
+ * @version 1.0.12 | Mon Jan 05 2026
4
+ * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
+ * @license MIT
6
+ */
7
+ (function webpackUniversalModuleDefinition(root, factory) {
8
+ if(typeof exports === 'object' && typeof module === 'object')
9
+ module.exports = factory();
10
+ else if(typeof define === 'function' && define.amd)
11
+ define([], factory);
12
+ else if(typeof exports === 'object')
13
+ exports["toastui"] = factory();
14
+ else
15
+ root["toastui"] = root["toastui"] || {}, root["toastui"]["Editor"] = root["toastui"]["Editor"] || {}, root["toastui"]["Editor"]["plugin"] = root["toastui"]["Editor"]["plugin"] || {}, root["toastui"]["Editor"]["plugin"]["details"] = factory();
16
+ })(self, function() {
17
+ return /******/ (function() { // webpackBootstrap
18
+ /******/ "use strict";
19
+ /******/ // The require scope
20
+ /******/ var __webpack_require__ = {};
21
+ /******/
22
+ /************************************************************************/
23
+ /******/ /* webpack/runtime/define property getters */
24
+ /******/ !function() {
25
+ /******/ // define getter functions for harmony exports
26
+ /******/ __webpack_require__.d = function(exports, definition) {
27
+ /******/ for(var key in definition) {
28
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
29
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
30
+ /******/ }
31
+ /******/ }
32
+ /******/ };
33
+ /******/ }();
34
+ /******/
35
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
36
+ /******/ !function() {
37
+ /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
38
+ /******/ }();
39
+ /******/
40
+ /************************************************************************/
41
+ var __webpack_exports__ = {};
42
+
43
+ // EXPORTS
44
+ __webpack_require__.d(__webpack_exports__, {
45
+ "default": function() { return /* binding */ detailsPlugin; }
46
+ });
47
+
48
+ ;// CONCATENATED MODULE: ../../node_modules/tslib/tslib.es6.mjs
49
+ /******************************************************************************
50
+ Copyright (c) Microsoft Corporation.
51
+
52
+ Permission to use, copy, modify, and/or distribute this software for any
53
+ purpose with or without fee is hereby granted.
54
+
55
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
56
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
57
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
58
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
59
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
60
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
61
+ PERFORMANCE OF THIS SOFTWARE.
62
+ ***************************************************************************** */
63
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
64
+
65
+ var extendStatics = function(d, b) {
66
+ extendStatics = Object.setPrototypeOf ||
67
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
68
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
69
+ return extendStatics(d, b);
70
+ };
71
+
72
+ function __extends(d, b) {
73
+ if (typeof b !== "function" && b !== null)
74
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
75
+ extendStatics(d, b);
76
+ function __() { this.constructor = d; }
77
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
78
+ }
79
+
80
+ var __assign = function() {
81
+ __assign = Object.assign || function __assign(t) {
82
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
83
+ s = arguments[i];
84
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
85
+ }
86
+ return t;
87
+ }
88
+ return __assign.apply(this, arguments);
89
+ }
90
+
91
+ function __rest(s, e) {
92
+ var t = {};
93
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
94
+ t[p] = s[p];
95
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
96
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
97
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
98
+ t[p[i]] = s[p[i]];
99
+ }
100
+ return t;
101
+ }
102
+
103
+ function __decorate(decorators, target, key, desc) {
104
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
105
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
106
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
107
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
108
+ }
109
+
110
+ function __param(paramIndex, decorator) {
111
+ return function (target, key) { decorator(target, key, paramIndex); }
112
+ }
113
+
114
+ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
115
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
116
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
117
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
118
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
119
+ var _, done = false;
120
+ for (var i = decorators.length - 1; i >= 0; i--) {
121
+ var context = {};
122
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
123
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
124
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
125
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
126
+ if (kind === "accessor") {
127
+ if (result === void 0) continue;
128
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
129
+ if (_ = accept(result.get)) descriptor.get = _;
130
+ if (_ = accept(result.set)) descriptor.set = _;
131
+ if (_ = accept(result.init)) initializers.unshift(_);
132
+ }
133
+ else if (_ = accept(result)) {
134
+ if (kind === "field") initializers.unshift(_);
135
+ else descriptor[key] = _;
136
+ }
137
+ }
138
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
139
+ done = true;
140
+ };
141
+
142
+ function __runInitializers(thisArg, initializers, value) {
143
+ var useValue = arguments.length > 2;
144
+ for (var i = 0; i < initializers.length; i++) {
145
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
146
+ }
147
+ return useValue ? value : void 0;
148
+ };
149
+
150
+ function __propKey(x) {
151
+ return typeof x === "symbol" ? x : "".concat(x);
152
+ };
153
+
154
+ function __setFunctionName(f, name, prefix) {
155
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
156
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
157
+ };
158
+
159
+ function __metadata(metadataKey, metadataValue) {
160
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
161
+ }
162
+
163
+ function __awaiter(thisArg, _arguments, P, generator) {
164
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
165
+ return new (P || (P = Promise))(function (resolve, reject) {
166
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
167
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
168
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
169
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
170
+ });
171
+ }
172
+
173
+ function __generator(thisArg, body) {
174
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
175
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
176
+ function verb(n) { return function (v) { return step([n, v]); }; }
177
+ function step(op) {
178
+ if (f) throw new TypeError("Generator is already executing.");
179
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
180
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
181
+ if (y = 0, t) op = [op[0] & 2, t.value];
182
+ switch (op[0]) {
183
+ case 0: case 1: t = op; break;
184
+ case 4: _.label++; return { value: op[1], done: false };
185
+ case 5: _.label++; y = op[1]; op = [0]; continue;
186
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
187
+ default:
188
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
189
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
190
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
191
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
192
+ if (t[2]) _.ops.pop();
193
+ _.trys.pop(); continue;
194
+ }
195
+ op = body.call(thisArg, _);
196
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
197
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
198
+ }
199
+ }
200
+
201
+ var __createBinding = Object.create ? (function(o, m, k, k2) {
202
+ if (k2 === undefined) k2 = k;
203
+ var desc = Object.getOwnPropertyDescriptor(m, k);
204
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
205
+ desc = { enumerable: true, get: function() { return m[k]; } };
206
+ }
207
+ Object.defineProperty(o, k2, desc);
208
+ }) : (function(o, m, k, k2) {
209
+ if (k2 === undefined) k2 = k;
210
+ o[k2] = m[k];
211
+ });
212
+
213
+ function __exportStar(m, o) {
214
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
215
+ }
216
+
217
+ function __values(o) {
218
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
219
+ if (m) return m.call(o);
220
+ if (o && typeof o.length === "number") return {
221
+ next: function () {
222
+ if (o && i >= o.length) o = void 0;
223
+ return { value: o && o[i++], done: !o };
224
+ }
225
+ };
226
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
227
+ }
228
+
229
+ function __read(o, n) {
230
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
231
+ if (!m) return o;
232
+ var i = m.call(o), r, ar = [], e;
233
+ try {
234
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
235
+ }
236
+ catch (error) { e = { error: error }; }
237
+ finally {
238
+ try {
239
+ if (r && !r.done && (m = i["return"])) m.call(i);
240
+ }
241
+ finally { if (e) throw e.error; }
242
+ }
243
+ return ar;
244
+ }
245
+
246
+ /** @deprecated */
247
+ function __spread() {
248
+ for (var ar = [], i = 0; i < arguments.length; i++)
249
+ ar = ar.concat(__read(arguments[i]));
250
+ return ar;
251
+ }
252
+
253
+ /** @deprecated */
254
+ function __spreadArrays() {
255
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
256
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
257
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
258
+ r[k] = a[j];
259
+ return r;
260
+ }
261
+
262
+ function __spreadArray(to, from, pack) {
263
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
264
+ if (ar || !(i in from)) {
265
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
266
+ ar[i] = from[i];
267
+ }
268
+ }
269
+ return to.concat(ar || Array.prototype.slice.call(from));
270
+ }
271
+
272
+ function __await(v) {
273
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
274
+ }
275
+
276
+ function __asyncGenerator(thisArg, _arguments, generator) {
277
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
278
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
279
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
280
+ function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
281
+ function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
282
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
283
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
284
+ function fulfill(value) { resume("next", value); }
285
+ function reject(value) { resume("throw", value); }
286
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
287
+ }
288
+
289
+ function __asyncDelegator(o) {
290
+ var i, p;
291
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
292
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
293
+ }
294
+
295
+ function __asyncValues(o) {
296
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
297
+ var m = o[Symbol.asyncIterator], i;
298
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
299
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
300
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
301
+ }
302
+
303
+ function __makeTemplateObject(cooked, raw) {
304
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
305
+ return cooked;
306
+ };
307
+
308
+ var __setModuleDefault = Object.create ? (function(o, v) {
309
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
310
+ }) : function(o, v) {
311
+ o["default"] = v;
312
+ };
313
+
314
+ var ownKeys = function(o) {
315
+ ownKeys = Object.getOwnPropertyNames || function (o) {
316
+ var ar = [];
317
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
318
+ return ar;
319
+ };
320
+ return ownKeys(o);
321
+ };
322
+
323
+ function __importStar(mod) {
324
+ if (mod && mod.__esModule) return mod;
325
+ var result = {};
326
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
327
+ __setModuleDefault(result, mod);
328
+ return result;
329
+ }
330
+
331
+ function __importDefault(mod) {
332
+ return (mod && mod.__esModule) ? mod : { default: mod };
333
+ }
334
+
335
+ function __classPrivateFieldGet(receiver, state, kind, f) {
336
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
337
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
338
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
339
+ }
340
+
341
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
342
+ if (kind === "m") throw new TypeError("Private method is not writable");
343
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
344
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
345
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
346
+ }
347
+
348
+ function __classPrivateFieldIn(state, receiver) {
349
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
350
+ return typeof state === "function" ? receiver === state : state.has(receiver);
351
+ }
352
+
353
+ function __addDisposableResource(env, value, async) {
354
+ if (value !== null && value !== void 0) {
355
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
356
+ var dispose, inner;
357
+ if (async) {
358
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
359
+ dispose = value[Symbol.asyncDispose];
360
+ }
361
+ if (dispose === void 0) {
362
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
363
+ dispose = value[Symbol.dispose];
364
+ if (async) inner = dispose;
365
+ }
366
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
367
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
368
+ env.stack.push({ value: value, dispose: dispose, async: async });
369
+ }
370
+ else if (async) {
371
+ env.stack.push({ async: true });
372
+ }
373
+ return value;
374
+ }
375
+
376
+ var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
377
+ var e = new Error(message);
378
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
379
+ };
380
+
381
+ function __disposeResources(env) {
382
+ function fail(e) {
383
+ env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
384
+ env.hasError = true;
385
+ }
386
+ var r, s = 0;
387
+ function next() {
388
+ while (r = env.stack.pop()) {
389
+ try {
390
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
391
+ if (r.dispose) {
392
+ var result = r.dispose.call(r.value);
393
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
394
+ }
395
+ else s |= 1;
396
+ }
397
+ catch (e) {
398
+ fail(e);
399
+ }
400
+ }
401
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
402
+ if (env.hasError) throw env.error;
403
+ }
404
+ return next();
405
+ }
406
+
407
+ function __rewriteRelativeImportExtension(path, preserveJsx) {
408
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
409
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
410
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
411
+ });
412
+ }
413
+ return path;
414
+ }
415
+
416
+ /* harmony default export */ var tslib_es6 = ({
417
+ __extends,
418
+ __assign,
419
+ __rest,
420
+ __decorate,
421
+ __param,
422
+ __esDecorate,
423
+ __runInitializers,
424
+ __propKey,
425
+ __setFunctionName,
426
+ __metadata,
427
+ __awaiter,
428
+ __generator,
429
+ __createBinding,
430
+ __exportStar,
431
+ __values,
432
+ __read,
433
+ __spread,
434
+ __spreadArrays,
435
+ __spreadArray,
436
+ __await,
437
+ __asyncGenerator,
438
+ __asyncDelegator,
439
+ __asyncValues,
440
+ __makeTemplateObject,
441
+ __importStar,
442
+ __importDefault,
443
+ __classPrivateFieldGet,
444
+ __classPrivateFieldSet,
445
+ __classPrivateFieldIn,
446
+ __addDisposableResource,
447
+ __disposeResources,
448
+ __rewriteRelativeImportExtension,
449
+ });
450
+
451
+ ;// CONCATENATED MODULE: ./src/i18n/langs.ts
452
+ function addLangs(i18n) {
453
+ i18n.setLanguage(['en', 'en-US'], {
454
+ details: 'Collapsible Block',
455
+ summary: 'Summary header',
456
+ content: 'Hidden content',
457
+ });
458
+ i18n.setLanguage(['de', 'de-DE'], {
459
+ details: 'Aufklappbarer Block',
460
+ summary: 'Klick mich zum Aufklappen',
461
+ content: 'Hier steht der versteckte Inhalt',
462
+ });
463
+ }
464
+
465
+ ;// CONCATENATED MODULE: ./src/index.ts
466
+
467
+
468
+
469
+ var PREFIX = 'toastui-editor-';
470
+ function createToolbarItemOption(i18n) {
471
+ return {
472
+ name: 'details',
473
+ tooltip: i18n.get('details'),
474
+ className: PREFIX + "toolbar-icons details",
475
+ command: 'details',
476
+ };
477
+ }
478
+ function handleDetailsExit(context, event) {
479
+ var instance = context.instance;
480
+ if (!instance) {
481
+ console.log('[Details Plugin] No instance found');
482
+ return;
483
+ }
484
+ var editor = instance.getCurrentModeEditor();
485
+ if (!editor || !editor.view) {
486
+ console.log('[Details Plugin] No editor view found');
487
+ return;
488
+ }
489
+ var view = editor.view;
490
+ var state = view.state;
491
+ var selection = state.selection;
492
+ var $from = selection.$from;
493
+ // Find details node in ancestry
494
+ var detailsDepth = -1;
495
+ for (var d = $from.depth; d > 0; d -= 1) {
496
+ if ($from.node(d).type.name === 'details') {
497
+ detailsDepth = d;
498
+ break;
499
+ }
500
+ }
501
+ if (detailsDepth < 0) {
502
+ return;
503
+ }
504
+ var detailsNode = $from.node(detailsDepth);
505
+ var nodeStart = $from.before(detailsDepth);
506
+ var nodeEnd = nodeStart + detailsNode.nodeSize;
507
+ var afterPara = $from.after();
508
+ var isAtEnd = afterPara >= nodeEnd - 1;
509
+ console.log('[Details Plugin] Inside details:', {
510
+ key: event.key,
511
+ isAtEnd: isAtEnd,
512
+ afterPara: afterPara,
513
+ nodeEnd: nodeEnd,
514
+ parentType: $from.parent.type.name,
515
+ parentEmpty: $from.parent.content.size === 0,
516
+ });
517
+ if (!isAtEnd) {
518
+ return;
519
+ }
520
+ var tr = state.tr, schema = state.schema;
521
+ var SelectionClass = state.selection.constructor;
522
+ // Enter on empty paragraph
523
+ if (event.key === 'Enter') {
524
+ var isEmptyPara = $from.parent.type.name === 'paragraph' && $from.parent.content.size === 0;
525
+ if (!isEmptyPara) {
526
+ return;
527
+ }
528
+ // Check previous node to see if it's also an empty paragraph
529
+ // $from.index(0) gives the index in the parent details node
530
+ var index = $from.index(detailsDepth);
531
+ var prevNode = detailsNode.child(index - 1);
532
+ var isPrevEmptyPara = prevNode && prevNode.type.name === 'paragraph' && prevNode.content.size === 0;
533
+ if (!isPrevEmptyPara) {
534
+ console.log('[Details Plugin] Allowing one empty line. Not exiting yet.');
535
+ return;
536
+ }
537
+ console.log('[Details Plugin] EXITING via Double Enter (Two empty paras)!');
538
+ event.preventDefault();
539
+ var beforePara = $from.before();
540
+ // delete the current empty para and the previous one?
541
+ // Usually "Exit" means: Lift the current empty para out.
542
+ // But if we have TWO empty paras, maybe we want to keep one inside?
543
+ // Let's stick to: If two empty paras, we treat it as an exit signal.
544
+ // We should probably remove the *current* empty para and move the cursor out.
545
+ tr.delete(beforePara, afterPara);
546
+ var p = schema.nodes.paragraph.createAndFill();
547
+ var insertPos = nodeEnd - (afterPara - beforePara);
548
+ tr.insert(insertPos, p);
549
+ if (SelectionClass.near) {
550
+ tr.setSelection(SelectionClass.near(tr.doc.resolve(insertPos + 1)));
551
+ }
552
+ view.dispatch(tr);
553
+ }
554
+ // ArrowDown at end of content
555
+ if (event.key === 'ArrowDown') {
556
+ var atEndOfParent = $from.parentOffset === $from.parent.content.size;
557
+ if (!atEndOfParent) {
558
+ return;
559
+ }
560
+ console.log('[Details Plugin] EXITING via ArrowDown!');
561
+ event.preventDefault();
562
+ if (nodeEnd < state.doc.content.size) {
563
+ if (SelectionClass.near) {
564
+ tr.setSelection(SelectionClass.near(tr.doc.resolve(nodeEnd)));
565
+ view.dispatch(tr);
566
+ }
567
+ }
568
+ else {
569
+ var p = schema.nodes.paragraph.createAndFill();
570
+ tr.insert(nodeEnd, p);
571
+ if (SelectionClass.near) {
572
+ tr.setSelection(SelectionClass.near(tr.doc.resolve(nodeEnd + 1)));
573
+ }
574
+ view.dispatch(tr);
575
+ }
576
+ }
577
+ }
578
+ function detailsPlugin(context, options) {
579
+ if (options === void 0) { options = {}; }
580
+ var i18n = context.i18n, eventEmitter = context.eventEmitter;
581
+ addLangs(i18n);
582
+ var toolbarItem = createToolbarItemOption(i18n);
583
+ // Hook into the global keydown event for exit behavior
584
+ eventEmitter.listen('keydown', function (editorType, event) {
585
+ console.log('[Details Plugin] keydown via eventEmitter!', { editorType: editorType, key: event.key });
586
+ if (editorType !== 'wysiwyg') {
587
+ return;
588
+ }
589
+ if (event.key !== 'Enter' && event.key !== 'ArrowDown') {
590
+ return;
591
+ }
592
+ handleDetailsExit(context, event);
593
+ });
594
+ return {
595
+ toHTMLRenderers: {
596
+ htmlBlock: {
597
+ renderer: function (node) {
598
+ var isDetails = /<(\/)?(details|summary)/i.test(node.literal || '');
599
+ return isDetails
600
+ ? [{ type: 'html', content: node.literal || '' }]
601
+ : [
602
+ { type: 'openTag', tagName: 'div', outerNewLine: true },
603
+ { type: 'html', content: node.literal || '' },
604
+ { type: 'closeTag', tagName: 'div', outerNewLine: true },
605
+ ];
606
+ },
607
+ },
608
+ },
609
+ markdownCommands: {
610
+ details: function (payload, _a, dispatch) {
611
+ var tr = _a.tr, selection = _a.selection, schema = _a.schema;
612
+ var slice = selection.content();
613
+ var textContent = slice.content.textBetween(0, slice.content.size, '\n') || i18n.get('content');
614
+ var summaryText = i18n.get('summary');
615
+ var openTag = "<details>\n<summary>" + summaryText + "</summary>\n";
616
+ var closeTag = "\n</details>";
617
+ var newText = "" + openTag + textContent + closeTag;
618
+ tr.replaceSelectionWith(schema.text(newText));
619
+ dispatch(tr);
620
+ return true;
621
+ },
622
+ },
623
+ wysiwygNodeViews: {
624
+ details: function (node, view, getPos) {
625
+ var dom = document.createElement('details');
626
+ var htmlAttrs = node.attrs.htmlAttrs || {};
627
+ if (htmlAttrs.open !== null && typeof htmlAttrs.open !== 'undefined') {
628
+ dom.open = true;
629
+ }
630
+ dom.addEventListener('click', function (e) {
631
+ var target = e.target;
632
+ if (target.tagName === 'SUMMARY' || target.closest('summary')) {
633
+ e.preventDefault();
634
+ var pos = getPos();
635
+ if (typeof pos === 'number') {
636
+ var isOpen = htmlAttrs.open !== null && typeof htmlAttrs.open !== 'undefined';
637
+ var newHtmlAttrs = __assign({}, htmlAttrs);
638
+ if (isOpen) {
639
+ delete newHtmlAttrs.open;
640
+ }
641
+ else {
642
+ newHtmlAttrs.open = '';
643
+ }
644
+ var newAttrs = __assign(__assign({}, node.attrs), { htmlAttrs: newHtmlAttrs });
645
+ view.dispatch(view.state.tr.setNodeMarkup(pos, null, newAttrs));
646
+ }
647
+ }
648
+ });
649
+ return { dom: dom, contentDOM: dom };
650
+ },
651
+ },
652
+ wysiwygCommands: {
653
+ details: function (payload, _a, dispatch) {
654
+ var tr = _a.tr, schema = _a.schema;
655
+ var summaryText = i18n.get('summary');
656
+ var contentText = i18n.get('content');
657
+ var _b = schema.nodes, details = _b.details, summary = _b.summary, paragraph = _b.paragraph;
658
+ if (details && summary && paragraph) {
659
+ var summaryNode = summary.create({}, schema.text(summaryText));
660
+ var contentNode = paragraph.create({}, schema.text(contentText));
661
+ var detailsNode = details.create({}, [summaryNode, contentNode]);
662
+ tr.replaceSelectionWith(detailsNode);
663
+ dispatch(tr);
664
+ return true;
665
+ }
666
+ return false;
667
+ },
668
+ },
669
+ toolbarItems: [
670
+ {
671
+ groupIndex: 4,
672
+ itemIndex: 3,
673
+ item: toolbarItem,
674
+ },
675
+ ],
676
+ };
677
+ }
678
+
679
+ __webpack_exports__ = __webpack_exports__["default"];
680
+ /******/ return __webpack_exports__;
681
+ /******/ })()
682
+ ;
683
+ });
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * TOAST UI Editor : Text Align Plugin
3
+ * @version 1.0.12 | Mon Jan 05 2026
4
+ * @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
5
+ * @license MIT
6
+ */.toastui-editor-toolbar-icons.details{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m19 21-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z'/%3E%3Cpath d='m9 10 3 3 3-3'/%3E%3C/svg%3E")!important;background-position:50%!important;background-repeat:no-repeat!important;background-size:24px 24px!important;text-indent:-9999px!important}details{background-color:#f7f7f7;border:1px solid #e1e1e1;border-radius:4px;display:block;margin:10px 0;padding:10px}summary{cursor:pointer;font-weight:700;margin-bottom:5px;outline:none}.toastui-editor-dark .toastui-editor-toolbar-icons.details{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23eee' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m19 21-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z'/%3E%3Cpath d='m9 10 3 3 3-3'/%3E%3C/svg%3E")!important}.toastui-editor-dark details{background-color:#282a36;border-color:#44475a;color:#f8f8f2}