pressroom 0.1.0
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +22 -0
- data/MIT-LICENSE +20 -0
- data/README.md +172 -0
- data/Rakefile +8 -0
- data/app/assets/javascripts/pressroom/application.js +18 -0
- data/app/assets/javascripts/pressroom/controllers/editor_controller.js +146 -0
- data/app/assets/javascripts/pressroom/vendor/code.js +181 -0
- data/app/assets/javascripts/pressroom/vendor/delimiter.js +98 -0
- data/app/assets/javascripts/pressroom/vendor/editorjs.js +11217 -0
- data/app/assets/javascripts/pressroom/vendor/header.js +321 -0
- data/app/assets/javascripts/pressroom/vendor/image.js +1103 -0
- data/app/assets/javascripts/pressroom/vendor/inline-code.js +99 -0
- data/app/assets/javascripts/pressroom/vendor/list.js +2091 -0
- data/app/assets/javascripts/pressroom/vendor/marker.js +95 -0
- data/app/assets/javascripts/pressroom/vendor/quote.js +990 -0
- data/app/assets/javascripts/pressroom/vendor/stimulus.js +2563 -0
- data/app/assets/javascripts/pressroom/vendor/turbo.js +7256 -0
- data/app/assets/stylesheets/pressroom/admin.css +216 -0
- data/app/assets/stylesheets/pressroom/content.css +18 -0
- data/app/controllers/pressroom/application_controller.rb +41 -0
- data/app/controllers/pressroom/categories_controller.rb +50 -0
- data/app/controllers/pressroom/posts_controller.rb +98 -0
- data/app/controllers/pressroom/tags_controller.rb +39 -0
- data/app/controllers/pressroom/uploads_controller.rb +52 -0
- data/app/helpers/pressroom/application_helper.rb +4 -0
- data/app/helpers/pressroom/blocks_helper.rb +13 -0
- data/app/jobs/pressroom/application_job.rb +4 -0
- data/app/mailers/pressroom/application_mailer.rb +6 -0
- data/app/models/concerns/pressroom/authorable.rb +23 -0
- data/app/models/concerns/pressroom/sluggable.rb +66 -0
- data/app/models/pressroom/application_record.rb +7 -0
- data/app/models/pressroom/category.rb +54 -0
- data/app/models/pressroom/post.rb +90 -0
- data/app/models/pressroom/tag.rb +30 -0
- data/app/models/pressroom/tagging.rb +12 -0
- data/app/views/layouts/pressroom/admin.html.erb +34 -0
- data/app/views/layouts/pressroom/application.html.erb +17 -0
- data/app/views/pressroom/blocks/_code.html.erb +2 -0
- data/app/views/pressroom/blocks/_delimiter.html.erb +1 -0
- data/app/views/pressroom/blocks/_header.html.erb +5 -0
- data/app/views/pressroom/blocks/_image.html.erb +18 -0
- data/app/views/pressroom/blocks/_list.html.erb +6 -0
- data/app/views/pressroom/blocks/_list_items.html.erb +13 -0
- data/app/views/pressroom/blocks/_paragraph.html.erb +1 -0
- data/app/views/pressroom/blocks/_quote.html.erb +6 -0
- data/app/views/pressroom/categories/_form.html.erb +31 -0
- data/app/views/pressroom/categories/edit.html.erb +3 -0
- data/app/views/pressroom/categories/index.html.erb +34 -0
- data/app/views/pressroom/categories/new.html.erb +3 -0
- data/app/views/pressroom/posts/_form.html.erb +49 -0
- data/app/views/pressroom/posts/_post_row.html.erb +17 -0
- data/app/views/pressroom/posts/edit.html.erb +34 -0
- data/app/views/pressroom/posts/index.html.erb +38 -0
- data/app/views/pressroom/posts/new.html.erb +3 -0
- data/app/views/pressroom/tags/edit.html.erb +24 -0
- data/app/views/pressroom/tags/index.html.erb +27 -0
- data/config/editorjs_manifest.yml +53 -0
- data/config/importmap.rb +18 -0
- data/config/locales/pressroom.en.yml +16 -0
- data/config/locales/transliteration.ru.yml +70 -0
- data/config/locales/transliteration.uk.yml +70 -0
- data/config/routes.rb +17 -0
- data/db/migrate/20260821000001_create_pressroom_posts.rb +42 -0
- data/db/migrate/20260821000002_create_pressroom_taxonomy.rb +33 -0
- data/lib/pressroom/blocks/definition.rb +103 -0
- data/lib/pressroom/blocks/registry.rb +56 -0
- data/lib/pressroom/blocks/renderer.rb +97 -0
- data/lib/pressroom/blocks/sanitizer.rb +36 -0
- data/lib/pressroom/blocks/schema.rb +247 -0
- data/lib/pressroom/blocks/text_extractor.rb +46 -0
- data/lib/pressroom/built_in_blocks.rb +97 -0
- data/lib/pressroom/configuration.rb +64 -0
- data/lib/pressroom/engine.rb +33 -0
- data/lib/pressroom/errors.rb +11 -0
- data/lib/pressroom/feed.rb +69 -0
- data/lib/pressroom/transliteration.rb +213 -0
- data/lib/pressroom/version.rb +3 -0
- data/lib/pressroom.rb +70 -0
- data/lib/tasks/pressroom_tasks.rake +4 -0
- data/lib/tasks/pressroom_vendor.rake +31 -0
- metadata +171 -0
|
@@ -0,0 +1,990 @@
|
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".cdx-quote-icon svg{transform:rotate(180deg)}.cdx-quote{margin:0}.cdx-quote__text{min-height:158px;margin-bottom:10px}.cdx-quote [contentEditable=true][data-placeholder]:before{position:absolute;content:attr(data-placeholder);color:#707684;font-weight:400;opacity:0}.cdx-quote [contentEditable=true][data-placeholder]:empty:before{opacity:1}.cdx-quote [contentEditable=true][data-placeholder]:empty:focus:before{opacity:0}.cdx-quote-settings{display:flex}.cdx-quote-settings .cdx-settings-button{width:50%}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
const De = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 7L6 7"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 17H6"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 12L8 12"/></svg>', He = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M17 7L5 7"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M17 17H5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M13 12L5 12"/></svg>', Re = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 10.8182L9 10.8182C8.80222 10.8182 8.60888 10.7649 8.44443 10.665C8.27998 10.5651 8.15181 10.4231 8.07612 10.257C8.00043 10.0909 7.98063 9.90808 8.01922 9.73174C8.0578 9.55539 8.15304 9.39341 8.29289 9.26627C8.43275 9.13913 8.61093 9.05255 8.80491 9.01747C8.99889 8.98239 9.19996 9.00039 9.38268 9.0692C9.56541 9.13801 9.72159 9.25453 9.83147 9.40403C9.94135 9.55353 10 9.72929 10 9.90909L10 12.1818C10 12.664 9.78929 13.1265 9.41421 13.4675C9.03914 13.8084 8.53043 14 8 14"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 10.8182L15 10.8182C14.8022 10.8182 14.6089 10.7649 14.4444 10.665C14.28 10.5651 14.1518 10.4231 14.0761 10.257C14.0004 10.0909 13.9806 9.90808 14.0192 9.73174C14.0578 9.55539 14.153 9.39341 14.2929 9.26627C14.4327 9.13913 14.6109 9.05255 14.8049 9.01747C14.9989 8.98239 15.2 9.00039 15.3827 9.0692C15.5654 9.13801 15.7216 9.25453 15.8315 9.40403C15.9414 9.55353 16 9.72929 16 9.90909L16 12.1818C16 12.664 15.7893 13.1265 15.4142 13.4675C15.0391 13.8084 14.5304 14 14 14"/></svg>';
|
|
3
|
+
var b = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
4
|
+
function Fe(e) {
|
|
5
|
+
if (e.__esModule)
|
|
6
|
+
return e;
|
|
7
|
+
var t = e.default;
|
|
8
|
+
if (typeof t == "function") {
|
|
9
|
+
var n = function r() {
|
|
10
|
+
return this instanceof r ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
n.prototype = t.prototype;
|
|
13
|
+
} else
|
|
14
|
+
n = {};
|
|
15
|
+
return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) {
|
|
16
|
+
var i = Object.getOwnPropertyDescriptor(e, r);
|
|
17
|
+
Object.defineProperty(n, r, i.get ? i : {
|
|
18
|
+
enumerable: !0,
|
|
19
|
+
get: function() {
|
|
20
|
+
return e[r];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}), n;
|
|
24
|
+
}
|
|
25
|
+
var v = {}, P = {}, j = {};
|
|
26
|
+
Object.defineProperty(j, "__esModule", { value: !0 });
|
|
27
|
+
j.allInputsSelector = We;
|
|
28
|
+
function We() {
|
|
29
|
+
var e = ["text", "password", "email", "number", "search", "tel", "url"];
|
|
30
|
+
return "[contenteditable=true], textarea, input:not([type]), " + e.map(function(t) {
|
|
31
|
+
return 'input[type="'.concat(t, '"]');
|
|
32
|
+
}).join(", ");
|
|
33
|
+
}
|
|
34
|
+
(function(e) {
|
|
35
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.allInputsSelector = void 0;
|
|
36
|
+
var t = j;
|
|
37
|
+
Object.defineProperty(e, "allInputsSelector", { enumerable: !0, get: function() {
|
|
38
|
+
return t.allInputsSelector;
|
|
39
|
+
} });
|
|
40
|
+
})(P);
|
|
41
|
+
var c = {}, T = {};
|
|
42
|
+
Object.defineProperty(T, "__esModule", { value: !0 });
|
|
43
|
+
T.isNativeInput = Ue;
|
|
44
|
+
function Ue(e) {
|
|
45
|
+
var t = [
|
|
46
|
+
"INPUT",
|
|
47
|
+
"TEXTAREA"
|
|
48
|
+
];
|
|
49
|
+
return e && e.tagName ? t.includes(e.tagName) : !1;
|
|
50
|
+
}
|
|
51
|
+
(function(e) {
|
|
52
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.isNativeInput = void 0;
|
|
53
|
+
var t = T;
|
|
54
|
+
Object.defineProperty(e, "isNativeInput", { enumerable: !0, get: function() {
|
|
55
|
+
return t.isNativeInput;
|
|
56
|
+
} });
|
|
57
|
+
})(c);
|
|
58
|
+
var ie = {}, C = {};
|
|
59
|
+
Object.defineProperty(C, "__esModule", { value: !0 });
|
|
60
|
+
C.append = qe;
|
|
61
|
+
function qe(e, t) {
|
|
62
|
+
Array.isArray(t) ? t.forEach(function(n) {
|
|
63
|
+
e.appendChild(n);
|
|
64
|
+
}) : e.appendChild(t);
|
|
65
|
+
}
|
|
66
|
+
(function(e) {
|
|
67
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.append = void 0;
|
|
68
|
+
var t = C;
|
|
69
|
+
Object.defineProperty(e, "append", { enumerable: !0, get: function() {
|
|
70
|
+
return t.append;
|
|
71
|
+
} });
|
|
72
|
+
})(ie);
|
|
73
|
+
var L = {}, S = {};
|
|
74
|
+
Object.defineProperty(S, "__esModule", { value: !0 });
|
|
75
|
+
S.blockElements = ze;
|
|
76
|
+
function ze() {
|
|
77
|
+
return [
|
|
78
|
+
"address",
|
|
79
|
+
"article",
|
|
80
|
+
"aside",
|
|
81
|
+
"blockquote",
|
|
82
|
+
"canvas",
|
|
83
|
+
"div",
|
|
84
|
+
"dl",
|
|
85
|
+
"dt",
|
|
86
|
+
"fieldset",
|
|
87
|
+
"figcaption",
|
|
88
|
+
"figure",
|
|
89
|
+
"footer",
|
|
90
|
+
"form",
|
|
91
|
+
"h1",
|
|
92
|
+
"h2",
|
|
93
|
+
"h3",
|
|
94
|
+
"h4",
|
|
95
|
+
"h5",
|
|
96
|
+
"h6",
|
|
97
|
+
"header",
|
|
98
|
+
"hgroup",
|
|
99
|
+
"hr",
|
|
100
|
+
"li",
|
|
101
|
+
"main",
|
|
102
|
+
"nav",
|
|
103
|
+
"noscript",
|
|
104
|
+
"ol",
|
|
105
|
+
"output",
|
|
106
|
+
"p",
|
|
107
|
+
"pre",
|
|
108
|
+
"ruby",
|
|
109
|
+
"section",
|
|
110
|
+
"table",
|
|
111
|
+
"tbody",
|
|
112
|
+
"thead",
|
|
113
|
+
"tr",
|
|
114
|
+
"tfoot",
|
|
115
|
+
"ul",
|
|
116
|
+
"video"
|
|
117
|
+
];
|
|
118
|
+
}
|
|
119
|
+
(function(e) {
|
|
120
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.blockElements = void 0;
|
|
121
|
+
var t = S;
|
|
122
|
+
Object.defineProperty(e, "blockElements", { enumerable: !0, get: function() {
|
|
123
|
+
return t.blockElements;
|
|
124
|
+
} });
|
|
125
|
+
})(L);
|
|
126
|
+
var ae = {}, M = {};
|
|
127
|
+
Object.defineProperty(M, "__esModule", { value: !0 });
|
|
128
|
+
M.calculateBaseline = Ge;
|
|
129
|
+
function Ge(e) {
|
|
130
|
+
var t = window.getComputedStyle(e), n = parseFloat(t.fontSize), r = parseFloat(t.lineHeight) || n * 1.2, i = parseFloat(t.paddingTop), a = parseFloat(t.borderTopWidth), l = parseFloat(t.marginTop), u = n * 0.8, d = (r - n) / 2, s = l + a + i + d + u;
|
|
131
|
+
return s;
|
|
132
|
+
}
|
|
133
|
+
(function(e) {
|
|
134
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.calculateBaseline = void 0;
|
|
135
|
+
var t = M;
|
|
136
|
+
Object.defineProperty(e, "calculateBaseline", { enumerable: !0, get: function() {
|
|
137
|
+
return t.calculateBaseline;
|
|
138
|
+
} });
|
|
139
|
+
})(ae);
|
|
140
|
+
var le = {}, k = {}, w = {}, N = {};
|
|
141
|
+
Object.defineProperty(N, "__esModule", { value: !0 });
|
|
142
|
+
N.isContentEditable = Ke;
|
|
143
|
+
function Ke(e) {
|
|
144
|
+
return e.contentEditable === "true";
|
|
145
|
+
}
|
|
146
|
+
(function(e) {
|
|
147
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.isContentEditable = void 0;
|
|
148
|
+
var t = N;
|
|
149
|
+
Object.defineProperty(e, "isContentEditable", { enumerable: !0, get: function() {
|
|
150
|
+
return t.isContentEditable;
|
|
151
|
+
} });
|
|
152
|
+
})(w);
|
|
153
|
+
Object.defineProperty(k, "__esModule", { value: !0 });
|
|
154
|
+
k.canSetCaret = Qe;
|
|
155
|
+
var Xe = c, Ye = w;
|
|
156
|
+
function Qe(e) {
|
|
157
|
+
var t = !0;
|
|
158
|
+
if ((0, Xe.isNativeInput)(e))
|
|
159
|
+
switch (e.type) {
|
|
160
|
+
case "file":
|
|
161
|
+
case "checkbox":
|
|
162
|
+
case "radio":
|
|
163
|
+
case "hidden":
|
|
164
|
+
case "submit":
|
|
165
|
+
case "button":
|
|
166
|
+
case "image":
|
|
167
|
+
case "reset":
|
|
168
|
+
t = !1;
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
else
|
|
172
|
+
t = (0, Ye.isContentEditable)(e);
|
|
173
|
+
return t;
|
|
174
|
+
}
|
|
175
|
+
(function(e) {
|
|
176
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.canSetCaret = void 0;
|
|
177
|
+
var t = k;
|
|
178
|
+
Object.defineProperty(e, "canSetCaret", { enumerable: !0, get: function() {
|
|
179
|
+
return t.canSetCaret;
|
|
180
|
+
} });
|
|
181
|
+
})(le);
|
|
182
|
+
var y = {}, I = {};
|
|
183
|
+
function Ve(e, t, n) {
|
|
184
|
+
const r = n.value !== void 0 ? "value" : "get", i = n[r], a = `#${t}Cache`;
|
|
185
|
+
if (n[r] = function(...l) {
|
|
186
|
+
return this[a] === void 0 && (this[a] = i.apply(this, l)), this[a];
|
|
187
|
+
}, r === "get" && n.set) {
|
|
188
|
+
const l = n.set;
|
|
189
|
+
n.set = function(u) {
|
|
190
|
+
delete e[a], l.apply(this, u);
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
return n;
|
|
194
|
+
}
|
|
195
|
+
function ue() {
|
|
196
|
+
const e = {
|
|
197
|
+
win: !1,
|
|
198
|
+
mac: !1,
|
|
199
|
+
x11: !1,
|
|
200
|
+
linux: !1
|
|
201
|
+
}, t = Object.keys(e).find((n) => window.navigator.appVersion.toLowerCase().indexOf(n) !== -1);
|
|
202
|
+
return t !== void 0 && (e[t] = !0), e;
|
|
203
|
+
}
|
|
204
|
+
function A(e) {
|
|
205
|
+
return e != null && e !== "" && (typeof e != "object" || Object.keys(e).length > 0);
|
|
206
|
+
}
|
|
207
|
+
function Ze(e) {
|
|
208
|
+
return !A(e);
|
|
209
|
+
}
|
|
210
|
+
const Je = () => typeof window < "u" && window.navigator !== null && A(window.navigator.platform) && (/iP(ad|hone|od)/.test(window.navigator.platform) || window.navigator.platform === "MacIntel" && window.navigator.maxTouchPoints > 1);
|
|
211
|
+
function xe(e) {
|
|
212
|
+
const t = ue();
|
|
213
|
+
return e = e.replace(/shift/gi, "⇧").replace(/backspace/gi, "⌫").replace(/enter/gi, "⏎").replace(/up/gi, "↑").replace(/left/gi, "→").replace(/down/gi, "↓").replace(/right/gi, "←").replace(/escape/gi, "⎋").replace(/insert/gi, "Ins").replace(/delete/gi, "␡").replace(/\+/gi, "+"), t.mac ? e = e.replace(/ctrl|cmd/gi, "⌘").replace(/alt/gi, "⌥") : e = e.replace(/cmd/gi, "Ctrl").replace(/windows/gi, "WIN"), e;
|
|
214
|
+
}
|
|
215
|
+
function et(e) {
|
|
216
|
+
return e[0].toUpperCase() + e.slice(1);
|
|
217
|
+
}
|
|
218
|
+
function tt(e) {
|
|
219
|
+
const t = document.createElement("div");
|
|
220
|
+
t.style.position = "absolute", t.style.left = "-999px", t.style.bottom = "-999px", t.innerHTML = e, document.body.appendChild(t);
|
|
221
|
+
const n = window.getSelection(), r = document.createRange();
|
|
222
|
+
if (r.selectNode(t), n === null)
|
|
223
|
+
throw new Error("Cannot copy text to clipboard");
|
|
224
|
+
n.removeAllRanges(), n.addRange(r), document.execCommand("copy"), document.body.removeChild(t);
|
|
225
|
+
}
|
|
226
|
+
function nt(e, t, n) {
|
|
227
|
+
let r;
|
|
228
|
+
return (...i) => {
|
|
229
|
+
const a = this, l = () => {
|
|
230
|
+
r = void 0, n !== !0 && e.apply(a, i);
|
|
231
|
+
}, u = n === !0 && r !== void 0;
|
|
232
|
+
window.clearTimeout(r), r = window.setTimeout(l, t), u && e.apply(a, i);
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function o(e) {
|
|
236
|
+
return Object.prototype.toString.call(e).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
|
|
237
|
+
}
|
|
238
|
+
function rt(e) {
|
|
239
|
+
return o(e) === "boolean";
|
|
240
|
+
}
|
|
241
|
+
function oe(e) {
|
|
242
|
+
return o(e) === "function" || o(e) === "asyncfunction";
|
|
243
|
+
}
|
|
244
|
+
function it(e) {
|
|
245
|
+
return oe(e) && /^\s*class\s+/.test(e.toString());
|
|
246
|
+
}
|
|
247
|
+
function at(e) {
|
|
248
|
+
return o(e) === "number";
|
|
249
|
+
}
|
|
250
|
+
function g(e) {
|
|
251
|
+
return o(e) === "object";
|
|
252
|
+
}
|
|
253
|
+
function lt(e) {
|
|
254
|
+
return Promise.resolve(e) === e;
|
|
255
|
+
}
|
|
256
|
+
function ut(e) {
|
|
257
|
+
return o(e) === "string";
|
|
258
|
+
}
|
|
259
|
+
function ot(e) {
|
|
260
|
+
return o(e) === "undefined";
|
|
261
|
+
}
|
|
262
|
+
function O(e, ...t) {
|
|
263
|
+
if (!t.length)
|
|
264
|
+
return e;
|
|
265
|
+
const n = t.shift();
|
|
266
|
+
if (g(e) && g(n))
|
|
267
|
+
for (const r in n)
|
|
268
|
+
g(n[r]) ? (e[r] === void 0 && Object.assign(e, { [r]: {} }), O(e[r], n[r])) : Object.assign(e, { [r]: n[r] });
|
|
269
|
+
return O(e, ...t);
|
|
270
|
+
}
|
|
271
|
+
function st(e, t, n) {
|
|
272
|
+
const r = `«${t}» is deprecated and will be removed in the next major release. Please use the «${n}» instead.`;
|
|
273
|
+
e && console.warn(r);
|
|
274
|
+
}
|
|
275
|
+
function ct(e) {
|
|
276
|
+
try {
|
|
277
|
+
return new URL(e).href;
|
|
278
|
+
} catch {
|
|
279
|
+
}
|
|
280
|
+
return e.substring(0, 2) === "//" ? window.location.protocol + e : window.location.origin + e;
|
|
281
|
+
}
|
|
282
|
+
function dt(e) {
|
|
283
|
+
return e > 47 && e < 58 || e === 32 || e === 13 || e === 229 || e > 64 && e < 91 || e > 95 && e < 112 || e > 185 && e < 193 || e > 218 && e < 223;
|
|
284
|
+
}
|
|
285
|
+
const ft = {
|
|
286
|
+
BACKSPACE: 8,
|
|
287
|
+
TAB: 9,
|
|
288
|
+
ENTER: 13,
|
|
289
|
+
SHIFT: 16,
|
|
290
|
+
CTRL: 17,
|
|
291
|
+
ALT: 18,
|
|
292
|
+
ESC: 27,
|
|
293
|
+
SPACE: 32,
|
|
294
|
+
LEFT: 37,
|
|
295
|
+
UP: 38,
|
|
296
|
+
DOWN: 40,
|
|
297
|
+
RIGHT: 39,
|
|
298
|
+
DELETE: 46,
|
|
299
|
+
META: 91,
|
|
300
|
+
SLASH: 191
|
|
301
|
+
}, pt = {
|
|
302
|
+
LEFT: 0,
|
|
303
|
+
WHEEL: 1,
|
|
304
|
+
RIGHT: 2,
|
|
305
|
+
BACKWARD: 3,
|
|
306
|
+
FORWARD: 4
|
|
307
|
+
};
|
|
308
|
+
class vt {
|
|
309
|
+
constructor() {
|
|
310
|
+
this.completed = Promise.resolve();
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Add new promise to queue
|
|
314
|
+
* @param operation - promise should be added to queue
|
|
315
|
+
*/
|
|
316
|
+
add(t) {
|
|
317
|
+
return new Promise((n, r) => {
|
|
318
|
+
this.completed = this.completed.then(t).then(n).catch(r);
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
function gt(e, t, n = void 0) {
|
|
323
|
+
let r, i, a, l = null, u = 0;
|
|
324
|
+
n || (n = {});
|
|
325
|
+
const d = function() {
|
|
326
|
+
u = n.leading === !1 ? 0 : Date.now(), l = null, a = e.apply(r, i), l === null && (r = i = null);
|
|
327
|
+
};
|
|
328
|
+
return function() {
|
|
329
|
+
const s = Date.now();
|
|
330
|
+
!u && n.leading === !1 && (u = s);
|
|
331
|
+
const f = t - (s - u);
|
|
332
|
+
return r = this, i = arguments, f <= 0 || f > t ? (l && (clearTimeout(l), l = null), u = s, a = e.apply(r, i), l === null && (r = i = null)) : !l && n.trailing !== !1 && (l = setTimeout(d, f)), a;
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
const mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
336
|
+
__proto__: null,
|
|
337
|
+
PromiseQueue: vt,
|
|
338
|
+
beautifyShortcut: xe,
|
|
339
|
+
cacheable: Ve,
|
|
340
|
+
capitalize: et,
|
|
341
|
+
copyTextToClipboard: tt,
|
|
342
|
+
debounce: nt,
|
|
343
|
+
deepMerge: O,
|
|
344
|
+
deprecationAssert: st,
|
|
345
|
+
getUserOS: ue,
|
|
346
|
+
getValidUrl: ct,
|
|
347
|
+
isBoolean: rt,
|
|
348
|
+
isClass: it,
|
|
349
|
+
isEmpty: Ze,
|
|
350
|
+
isFunction: oe,
|
|
351
|
+
isIosDevice: Je,
|
|
352
|
+
isNumber: at,
|
|
353
|
+
isObject: g,
|
|
354
|
+
isPrintableKey: dt,
|
|
355
|
+
isPromise: lt,
|
|
356
|
+
isString: ut,
|
|
357
|
+
isUndefined: ot,
|
|
358
|
+
keyCodes: ft,
|
|
359
|
+
mouseButtons: pt,
|
|
360
|
+
notEmpty: A,
|
|
361
|
+
throttle: gt,
|
|
362
|
+
typeOf: o
|
|
363
|
+
}, Symbol.toStringTag, { value: "Module" })), $ = /* @__PURE__ */ Fe(mt);
|
|
364
|
+
Object.defineProperty(I, "__esModule", { value: !0 });
|
|
365
|
+
I.containsOnlyInlineElements = _t;
|
|
366
|
+
var bt = $, yt = L;
|
|
367
|
+
function _t(e) {
|
|
368
|
+
var t;
|
|
369
|
+
(0, bt.isString)(e) ? (t = document.createElement("div"), t.innerHTML = e) : t = e;
|
|
370
|
+
var n = function(r) {
|
|
371
|
+
return !(0, yt.blockElements)().includes(r.tagName.toLowerCase()) && Array.from(r.children).every(n);
|
|
372
|
+
};
|
|
373
|
+
return Array.from(t.children).every(n);
|
|
374
|
+
}
|
|
375
|
+
(function(e) {
|
|
376
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.containsOnlyInlineElements = void 0;
|
|
377
|
+
var t = I;
|
|
378
|
+
Object.defineProperty(e, "containsOnlyInlineElements", { enumerable: !0, get: function() {
|
|
379
|
+
return t.containsOnlyInlineElements;
|
|
380
|
+
} });
|
|
381
|
+
})(y);
|
|
382
|
+
var se = {}, B = {}, _ = {}, D = {};
|
|
383
|
+
Object.defineProperty(D, "__esModule", { value: !0 });
|
|
384
|
+
D.make = ht;
|
|
385
|
+
function ht(e, t, n) {
|
|
386
|
+
var r;
|
|
387
|
+
t === void 0 && (t = null), n === void 0 && (n = {});
|
|
388
|
+
var i = document.createElement(e);
|
|
389
|
+
if (Array.isArray(t)) {
|
|
390
|
+
var a = t.filter(function(u) {
|
|
391
|
+
return u !== void 0;
|
|
392
|
+
});
|
|
393
|
+
(r = i.classList).add.apply(r, a);
|
|
394
|
+
} else
|
|
395
|
+
t !== null && i.classList.add(t);
|
|
396
|
+
for (var l in n)
|
|
397
|
+
Object.prototype.hasOwnProperty.call(n, l) && (i[l] = n[l]);
|
|
398
|
+
return i;
|
|
399
|
+
}
|
|
400
|
+
(function(e) {
|
|
401
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.make = void 0;
|
|
402
|
+
var t = D;
|
|
403
|
+
Object.defineProperty(e, "make", { enumerable: !0, get: function() {
|
|
404
|
+
return t.make;
|
|
405
|
+
} });
|
|
406
|
+
})(_);
|
|
407
|
+
Object.defineProperty(B, "__esModule", { value: !0 });
|
|
408
|
+
B.fragmentToString = Ot;
|
|
409
|
+
var Et = _;
|
|
410
|
+
function Ot(e) {
|
|
411
|
+
var t = (0, Et.make)("div");
|
|
412
|
+
return t.appendChild(e), t.innerHTML;
|
|
413
|
+
}
|
|
414
|
+
(function(e) {
|
|
415
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.fragmentToString = void 0;
|
|
416
|
+
var t = B;
|
|
417
|
+
Object.defineProperty(e, "fragmentToString", { enumerable: !0, get: function() {
|
|
418
|
+
return t.fragmentToString;
|
|
419
|
+
} });
|
|
420
|
+
})(se);
|
|
421
|
+
var ce = {}, H = {};
|
|
422
|
+
Object.defineProperty(H, "__esModule", { value: !0 });
|
|
423
|
+
H.getContentLength = jt;
|
|
424
|
+
var Pt = c;
|
|
425
|
+
function jt(e) {
|
|
426
|
+
var t, n;
|
|
427
|
+
return (0, Pt.isNativeInput)(e) ? e.value.length : e.nodeType === Node.TEXT_NODE ? e.length : (n = (t = e.textContent) === null || t === void 0 ? void 0 : t.length) !== null && n !== void 0 ? n : 0;
|
|
428
|
+
}
|
|
429
|
+
(function(e) {
|
|
430
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.getContentLength = void 0;
|
|
431
|
+
var t = H;
|
|
432
|
+
Object.defineProperty(e, "getContentLength", { enumerable: !0, get: function() {
|
|
433
|
+
return t.getContentLength;
|
|
434
|
+
} });
|
|
435
|
+
})(ce);
|
|
436
|
+
var R = {}, F = {}, re = b && b.__spreadArray || function(e, t, n) {
|
|
437
|
+
if (n || arguments.length === 2)
|
|
438
|
+
for (var r = 0, i = t.length, a; r < i; r++)
|
|
439
|
+
(a || !(r in t)) && (a || (a = Array.prototype.slice.call(t, 0, r)), a[r] = t[r]);
|
|
440
|
+
return e.concat(a || Array.prototype.slice.call(t));
|
|
441
|
+
};
|
|
442
|
+
Object.defineProperty(F, "__esModule", { value: !0 });
|
|
443
|
+
F.getDeepestBlockElements = de;
|
|
444
|
+
var Tt = y;
|
|
445
|
+
function de(e) {
|
|
446
|
+
return (0, Tt.containsOnlyInlineElements)(e) ? [e] : Array.from(e.children).reduce(function(t, n) {
|
|
447
|
+
return re(re([], t, !0), de(n), !0);
|
|
448
|
+
}, []);
|
|
449
|
+
}
|
|
450
|
+
(function(e) {
|
|
451
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.getDeepestBlockElements = void 0;
|
|
452
|
+
var t = F;
|
|
453
|
+
Object.defineProperty(e, "getDeepestBlockElements", { enumerable: !0, get: function() {
|
|
454
|
+
return t.getDeepestBlockElements;
|
|
455
|
+
} });
|
|
456
|
+
})(R);
|
|
457
|
+
var fe = {}, W = {}, h = {}, U = {};
|
|
458
|
+
Object.defineProperty(U, "__esModule", { value: !0 });
|
|
459
|
+
U.isLineBreakTag = Ct;
|
|
460
|
+
function Ct(e) {
|
|
461
|
+
return [
|
|
462
|
+
"BR",
|
|
463
|
+
"WBR"
|
|
464
|
+
].includes(e.tagName);
|
|
465
|
+
}
|
|
466
|
+
(function(e) {
|
|
467
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.isLineBreakTag = void 0;
|
|
468
|
+
var t = U;
|
|
469
|
+
Object.defineProperty(e, "isLineBreakTag", { enumerable: !0, get: function() {
|
|
470
|
+
return t.isLineBreakTag;
|
|
471
|
+
} });
|
|
472
|
+
})(h);
|
|
473
|
+
var E = {}, q = {};
|
|
474
|
+
Object.defineProperty(q, "__esModule", { value: !0 });
|
|
475
|
+
q.isSingleTag = Lt;
|
|
476
|
+
function Lt(e) {
|
|
477
|
+
return [
|
|
478
|
+
"AREA",
|
|
479
|
+
"BASE",
|
|
480
|
+
"BR",
|
|
481
|
+
"COL",
|
|
482
|
+
"COMMAND",
|
|
483
|
+
"EMBED",
|
|
484
|
+
"HR",
|
|
485
|
+
"IMG",
|
|
486
|
+
"INPUT",
|
|
487
|
+
"KEYGEN",
|
|
488
|
+
"LINK",
|
|
489
|
+
"META",
|
|
490
|
+
"PARAM",
|
|
491
|
+
"SOURCE",
|
|
492
|
+
"TRACK",
|
|
493
|
+
"WBR"
|
|
494
|
+
].includes(e.tagName);
|
|
495
|
+
}
|
|
496
|
+
(function(e) {
|
|
497
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.isSingleTag = void 0;
|
|
498
|
+
var t = q;
|
|
499
|
+
Object.defineProperty(e, "isSingleTag", { enumerable: !0, get: function() {
|
|
500
|
+
return t.isSingleTag;
|
|
501
|
+
} });
|
|
502
|
+
})(E);
|
|
503
|
+
Object.defineProperty(W, "__esModule", { value: !0 });
|
|
504
|
+
W.getDeepestNode = pe;
|
|
505
|
+
var St = c, Mt = h, kt = E;
|
|
506
|
+
function pe(e, t) {
|
|
507
|
+
t === void 0 && (t = !1);
|
|
508
|
+
var n = t ? "lastChild" : "firstChild", r = t ? "previousSibling" : "nextSibling";
|
|
509
|
+
if (e.nodeType === Node.ELEMENT_NODE && e[n]) {
|
|
510
|
+
var i = e[n];
|
|
511
|
+
if ((0, kt.isSingleTag)(i) && !(0, St.isNativeInput)(i) && !(0, Mt.isLineBreakTag)(i))
|
|
512
|
+
if (i[r])
|
|
513
|
+
i = i[r];
|
|
514
|
+
else if (i.parentNode !== null && i.parentNode[r])
|
|
515
|
+
i = i.parentNode[r];
|
|
516
|
+
else
|
|
517
|
+
return i.parentNode;
|
|
518
|
+
return pe(i, t);
|
|
519
|
+
}
|
|
520
|
+
return e;
|
|
521
|
+
}
|
|
522
|
+
(function(e) {
|
|
523
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.getDeepestNode = void 0;
|
|
524
|
+
var t = W;
|
|
525
|
+
Object.defineProperty(e, "getDeepestNode", { enumerable: !0, get: function() {
|
|
526
|
+
return t.getDeepestNode;
|
|
527
|
+
} });
|
|
528
|
+
})(fe);
|
|
529
|
+
var ve = {}, z = {}, p = b && b.__spreadArray || function(e, t, n) {
|
|
530
|
+
if (n || arguments.length === 2)
|
|
531
|
+
for (var r = 0, i = t.length, a; r < i; r++)
|
|
532
|
+
(a || !(r in t)) && (a || (a = Array.prototype.slice.call(t, 0, r)), a[r] = t[r]);
|
|
533
|
+
return e.concat(a || Array.prototype.slice.call(t));
|
|
534
|
+
};
|
|
535
|
+
Object.defineProperty(z, "__esModule", { value: !0 });
|
|
536
|
+
z.findAllInputs = $t;
|
|
537
|
+
var wt = y, Nt = R, It = P, At = c;
|
|
538
|
+
function $t(e) {
|
|
539
|
+
return Array.from(e.querySelectorAll((0, It.allInputsSelector)())).reduce(function(t, n) {
|
|
540
|
+
return (0, At.isNativeInput)(n) || (0, wt.containsOnlyInlineElements)(n) ? p(p([], t, !0), [n], !1) : p(p([], t, !0), (0, Nt.getDeepestBlockElements)(n), !0);
|
|
541
|
+
}, []);
|
|
542
|
+
}
|
|
543
|
+
(function(e) {
|
|
544
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.findAllInputs = void 0;
|
|
545
|
+
var t = z;
|
|
546
|
+
Object.defineProperty(e, "findAllInputs", { enumerable: !0, get: function() {
|
|
547
|
+
return t.findAllInputs;
|
|
548
|
+
} });
|
|
549
|
+
})(ve);
|
|
550
|
+
var ge = {}, G = {};
|
|
551
|
+
Object.defineProperty(G, "__esModule", { value: !0 });
|
|
552
|
+
G.isCollapsedWhitespaces = Bt;
|
|
553
|
+
function Bt(e) {
|
|
554
|
+
return !/[^\t\n\r ]/.test(e);
|
|
555
|
+
}
|
|
556
|
+
(function(e) {
|
|
557
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.isCollapsedWhitespaces = void 0;
|
|
558
|
+
var t = G;
|
|
559
|
+
Object.defineProperty(e, "isCollapsedWhitespaces", { enumerable: !0, get: function() {
|
|
560
|
+
return t.isCollapsedWhitespaces;
|
|
561
|
+
} });
|
|
562
|
+
})(ge);
|
|
563
|
+
var K = {}, X = {};
|
|
564
|
+
Object.defineProperty(X, "__esModule", { value: !0 });
|
|
565
|
+
X.isElement = Ht;
|
|
566
|
+
var Dt = $;
|
|
567
|
+
function Ht(e) {
|
|
568
|
+
return (0, Dt.isNumber)(e) ? !1 : !!e && !!e.nodeType && e.nodeType === Node.ELEMENT_NODE;
|
|
569
|
+
}
|
|
570
|
+
(function(e) {
|
|
571
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.isElement = void 0;
|
|
572
|
+
var t = X;
|
|
573
|
+
Object.defineProperty(e, "isElement", { enumerable: !0, get: function() {
|
|
574
|
+
return t.isElement;
|
|
575
|
+
} });
|
|
576
|
+
})(K);
|
|
577
|
+
var me = {}, Y = {}, Q = {}, V = {};
|
|
578
|
+
Object.defineProperty(V, "__esModule", { value: !0 });
|
|
579
|
+
V.isLeaf = Rt;
|
|
580
|
+
function Rt(e) {
|
|
581
|
+
return e === null ? !1 : e.childNodes.length === 0;
|
|
582
|
+
}
|
|
583
|
+
(function(e) {
|
|
584
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.isLeaf = void 0;
|
|
585
|
+
var t = V;
|
|
586
|
+
Object.defineProperty(e, "isLeaf", { enumerable: !0, get: function() {
|
|
587
|
+
return t.isLeaf;
|
|
588
|
+
} });
|
|
589
|
+
})(Q);
|
|
590
|
+
var Z = {}, J = {};
|
|
591
|
+
Object.defineProperty(J, "__esModule", { value: !0 });
|
|
592
|
+
J.isNodeEmpty = zt;
|
|
593
|
+
var Ft = h, Wt = K, Ut = c, qt = E;
|
|
594
|
+
function zt(e, t) {
|
|
595
|
+
var n = "";
|
|
596
|
+
return (0, qt.isSingleTag)(e) && !(0, Ft.isLineBreakTag)(e) ? !1 : ((0, Wt.isElement)(e) && (0, Ut.isNativeInput)(e) ? n = e.value : e.textContent !== null && (n = e.textContent.replace("", "")), t !== void 0 && (n = n.replace(new RegExp(t, "g"), "")), n.trim().length === 0);
|
|
597
|
+
}
|
|
598
|
+
(function(e) {
|
|
599
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.isNodeEmpty = void 0;
|
|
600
|
+
var t = J;
|
|
601
|
+
Object.defineProperty(e, "isNodeEmpty", { enumerable: !0, get: function() {
|
|
602
|
+
return t.isNodeEmpty;
|
|
603
|
+
} });
|
|
604
|
+
})(Z);
|
|
605
|
+
Object.defineProperty(Y, "__esModule", { value: !0 });
|
|
606
|
+
Y.isEmpty = Xt;
|
|
607
|
+
var Gt = Q, Kt = Z;
|
|
608
|
+
function Xt(e, t) {
|
|
609
|
+
e.normalize();
|
|
610
|
+
for (var n = [e]; n.length > 0; ) {
|
|
611
|
+
var r = n.shift();
|
|
612
|
+
if (r) {
|
|
613
|
+
if (e = r, (0, Gt.isLeaf)(e) && !(0, Kt.isNodeEmpty)(e, t))
|
|
614
|
+
return !1;
|
|
615
|
+
n.push.apply(n, Array.from(e.childNodes));
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
return !0;
|
|
619
|
+
}
|
|
620
|
+
(function(e) {
|
|
621
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.isEmpty = void 0;
|
|
622
|
+
var t = Y;
|
|
623
|
+
Object.defineProperty(e, "isEmpty", { enumerable: !0, get: function() {
|
|
624
|
+
return t.isEmpty;
|
|
625
|
+
} });
|
|
626
|
+
})(me);
|
|
627
|
+
var be = {}, x = {};
|
|
628
|
+
Object.defineProperty(x, "__esModule", { value: !0 });
|
|
629
|
+
x.isFragment = Qt;
|
|
630
|
+
var Yt = $;
|
|
631
|
+
function Qt(e) {
|
|
632
|
+
return (0, Yt.isNumber)(e) ? !1 : !!e && !!e.nodeType && e.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
|
|
633
|
+
}
|
|
634
|
+
(function(e) {
|
|
635
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.isFragment = void 0;
|
|
636
|
+
var t = x;
|
|
637
|
+
Object.defineProperty(e, "isFragment", { enumerable: !0, get: function() {
|
|
638
|
+
return t.isFragment;
|
|
639
|
+
} });
|
|
640
|
+
})(be);
|
|
641
|
+
var ye = {}, ee = {};
|
|
642
|
+
Object.defineProperty(ee, "__esModule", { value: !0 });
|
|
643
|
+
ee.isHTMLString = Zt;
|
|
644
|
+
var Vt = _;
|
|
645
|
+
function Zt(e) {
|
|
646
|
+
var t = (0, Vt.make)("div");
|
|
647
|
+
return t.innerHTML = e, t.childElementCount > 0;
|
|
648
|
+
}
|
|
649
|
+
(function(e) {
|
|
650
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.isHTMLString = void 0;
|
|
651
|
+
var t = ee;
|
|
652
|
+
Object.defineProperty(e, "isHTMLString", { enumerable: !0, get: function() {
|
|
653
|
+
return t.isHTMLString;
|
|
654
|
+
} });
|
|
655
|
+
})(ye);
|
|
656
|
+
var _e = {}, te = {};
|
|
657
|
+
Object.defineProperty(te, "__esModule", { value: !0 });
|
|
658
|
+
te.offset = Jt;
|
|
659
|
+
function Jt(e) {
|
|
660
|
+
var t = e.getBoundingClientRect(), n = window.pageXOffset || document.documentElement.scrollLeft, r = window.pageYOffset || document.documentElement.scrollTop, i = t.top + r, a = t.left + n;
|
|
661
|
+
return {
|
|
662
|
+
top: i,
|
|
663
|
+
left: a,
|
|
664
|
+
bottom: i + t.height,
|
|
665
|
+
right: a + t.width
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
(function(e) {
|
|
669
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.offset = void 0;
|
|
670
|
+
var t = te;
|
|
671
|
+
Object.defineProperty(e, "offset", { enumerable: !0, get: function() {
|
|
672
|
+
return t.offset;
|
|
673
|
+
} });
|
|
674
|
+
})(_e);
|
|
675
|
+
var he = {}, ne = {};
|
|
676
|
+
Object.defineProperty(ne, "__esModule", { value: !0 });
|
|
677
|
+
ne.prepend = xt;
|
|
678
|
+
function xt(e, t) {
|
|
679
|
+
Array.isArray(t) ? (t = t.reverse(), t.forEach(function(n) {
|
|
680
|
+
return e.prepend(n);
|
|
681
|
+
})) : e.prepend(t);
|
|
682
|
+
}
|
|
683
|
+
(function(e) {
|
|
684
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.prepend = void 0;
|
|
685
|
+
var t = ne;
|
|
686
|
+
Object.defineProperty(e, "prepend", { enumerable: !0, get: function() {
|
|
687
|
+
return t.prepend;
|
|
688
|
+
} });
|
|
689
|
+
})(he);
|
|
690
|
+
(function(e) {
|
|
691
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.prepend = e.offset = e.make = e.isLineBreakTag = e.isSingleTag = e.isNodeEmpty = e.isLeaf = e.isHTMLString = e.isFragment = e.isEmpty = e.isElement = e.isContentEditable = e.isCollapsedWhitespaces = e.findAllInputs = e.isNativeInput = e.allInputsSelector = e.getDeepestNode = e.getDeepestBlockElements = e.getContentLength = e.fragmentToString = e.containsOnlyInlineElements = e.canSetCaret = e.calculateBaseline = e.blockElements = e.append = void 0;
|
|
692
|
+
var t = P;
|
|
693
|
+
Object.defineProperty(e, "allInputsSelector", { enumerable: !0, get: function() {
|
|
694
|
+
return t.allInputsSelector;
|
|
695
|
+
} });
|
|
696
|
+
var n = c;
|
|
697
|
+
Object.defineProperty(e, "isNativeInput", { enumerable: !0, get: function() {
|
|
698
|
+
return n.isNativeInput;
|
|
699
|
+
} });
|
|
700
|
+
var r = ie;
|
|
701
|
+
Object.defineProperty(e, "append", { enumerable: !0, get: function() {
|
|
702
|
+
return r.append;
|
|
703
|
+
} });
|
|
704
|
+
var i = L;
|
|
705
|
+
Object.defineProperty(e, "blockElements", { enumerable: !0, get: function() {
|
|
706
|
+
return i.blockElements;
|
|
707
|
+
} });
|
|
708
|
+
var a = ae;
|
|
709
|
+
Object.defineProperty(e, "calculateBaseline", { enumerable: !0, get: function() {
|
|
710
|
+
return a.calculateBaseline;
|
|
711
|
+
} });
|
|
712
|
+
var l = le;
|
|
713
|
+
Object.defineProperty(e, "canSetCaret", { enumerable: !0, get: function() {
|
|
714
|
+
return l.canSetCaret;
|
|
715
|
+
} });
|
|
716
|
+
var u = y;
|
|
717
|
+
Object.defineProperty(e, "containsOnlyInlineElements", { enumerable: !0, get: function() {
|
|
718
|
+
return u.containsOnlyInlineElements;
|
|
719
|
+
} });
|
|
720
|
+
var d = se;
|
|
721
|
+
Object.defineProperty(e, "fragmentToString", { enumerable: !0, get: function() {
|
|
722
|
+
return d.fragmentToString;
|
|
723
|
+
} });
|
|
724
|
+
var s = ce;
|
|
725
|
+
Object.defineProperty(e, "getContentLength", { enumerable: !0, get: function() {
|
|
726
|
+
return s.getContentLength;
|
|
727
|
+
} });
|
|
728
|
+
var f = R;
|
|
729
|
+
Object.defineProperty(e, "getDeepestBlockElements", { enumerable: !0, get: function() {
|
|
730
|
+
return f.getDeepestBlockElements;
|
|
731
|
+
} });
|
|
732
|
+
var Oe = fe;
|
|
733
|
+
Object.defineProperty(e, "getDeepestNode", { enumerable: !0, get: function() {
|
|
734
|
+
return Oe.getDeepestNode;
|
|
735
|
+
} });
|
|
736
|
+
var Pe = ve;
|
|
737
|
+
Object.defineProperty(e, "findAllInputs", { enumerable: !0, get: function() {
|
|
738
|
+
return Pe.findAllInputs;
|
|
739
|
+
} });
|
|
740
|
+
var je = ge;
|
|
741
|
+
Object.defineProperty(e, "isCollapsedWhitespaces", { enumerable: !0, get: function() {
|
|
742
|
+
return je.isCollapsedWhitespaces;
|
|
743
|
+
} });
|
|
744
|
+
var Te = w;
|
|
745
|
+
Object.defineProperty(e, "isContentEditable", { enumerable: !0, get: function() {
|
|
746
|
+
return Te.isContentEditable;
|
|
747
|
+
} });
|
|
748
|
+
var Ce = K;
|
|
749
|
+
Object.defineProperty(e, "isElement", { enumerable: !0, get: function() {
|
|
750
|
+
return Ce.isElement;
|
|
751
|
+
} });
|
|
752
|
+
var Le = me;
|
|
753
|
+
Object.defineProperty(e, "isEmpty", { enumerable: !0, get: function() {
|
|
754
|
+
return Le.isEmpty;
|
|
755
|
+
} });
|
|
756
|
+
var Se = be;
|
|
757
|
+
Object.defineProperty(e, "isFragment", { enumerable: !0, get: function() {
|
|
758
|
+
return Se.isFragment;
|
|
759
|
+
} });
|
|
760
|
+
var Me = ye;
|
|
761
|
+
Object.defineProperty(e, "isHTMLString", { enumerable: !0, get: function() {
|
|
762
|
+
return Me.isHTMLString;
|
|
763
|
+
} });
|
|
764
|
+
var ke = Q;
|
|
765
|
+
Object.defineProperty(e, "isLeaf", { enumerable: !0, get: function() {
|
|
766
|
+
return ke.isLeaf;
|
|
767
|
+
} });
|
|
768
|
+
var we = Z;
|
|
769
|
+
Object.defineProperty(e, "isNodeEmpty", { enumerable: !0, get: function() {
|
|
770
|
+
return we.isNodeEmpty;
|
|
771
|
+
} });
|
|
772
|
+
var Ne = h;
|
|
773
|
+
Object.defineProperty(e, "isLineBreakTag", { enumerable: !0, get: function() {
|
|
774
|
+
return Ne.isLineBreakTag;
|
|
775
|
+
} });
|
|
776
|
+
var Ie = E;
|
|
777
|
+
Object.defineProperty(e, "isSingleTag", { enumerable: !0, get: function() {
|
|
778
|
+
return Ie.isSingleTag;
|
|
779
|
+
} });
|
|
780
|
+
var Ae = _;
|
|
781
|
+
Object.defineProperty(e, "make", { enumerable: !0, get: function() {
|
|
782
|
+
return Ae.make;
|
|
783
|
+
} });
|
|
784
|
+
var $e = _e;
|
|
785
|
+
Object.defineProperty(e, "offset", { enumerable: !0, get: function() {
|
|
786
|
+
return $e.offset;
|
|
787
|
+
} });
|
|
788
|
+
var Be = he;
|
|
789
|
+
Object.defineProperty(e, "prepend", { enumerable: !0, get: function() {
|
|
790
|
+
return Be.prepend;
|
|
791
|
+
} });
|
|
792
|
+
})(v);
|
|
793
|
+
var Ee = /* @__PURE__ */ ((e) => (e.Left = "left", e.Center = "center", e))(Ee || {});
|
|
794
|
+
class m {
|
|
795
|
+
/**
|
|
796
|
+
* Render plugin`s main Element and fill it with saved data
|
|
797
|
+
* @param params - Quote Tool constructor params
|
|
798
|
+
* @param params.data - previously saved data
|
|
799
|
+
* @param params.config - user config for Tool
|
|
800
|
+
* @param params.api - editor.js api
|
|
801
|
+
* @param params.readOnly - read only mode flag
|
|
802
|
+
*/
|
|
803
|
+
constructor({ data: t, config: n, api: r, readOnly: i, block: a }) {
|
|
804
|
+
const { DEFAULT_ALIGNMENT: l } = m;
|
|
805
|
+
this.api = r, this.readOnly = i, this.quotePlaceholder = r.i18n.t((n == null ? void 0 : n.quotePlaceholder) ?? m.DEFAULT_QUOTE_PLACEHOLDER), this.captionPlaceholder = r.i18n.t((n == null ? void 0 : n.captionPlaceholder) ?? m.DEFAULT_CAPTION_PLACEHOLDER), this.data = {
|
|
806
|
+
text: t.text || "",
|
|
807
|
+
caption: t.caption || "",
|
|
808
|
+
alignment: Object.values(Ee).includes(t.alignment) ? t.alignment : (n == null ? void 0 : n.defaultAlignment) ?? l
|
|
809
|
+
}, this.css = {
|
|
810
|
+
baseClass: this.api.styles.block,
|
|
811
|
+
wrapper: "cdx-quote",
|
|
812
|
+
text: "cdx-quote__text",
|
|
813
|
+
input: this.api.styles.input,
|
|
814
|
+
caption: "cdx-quote__caption"
|
|
815
|
+
}, this.block = a;
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Notify core that read-only mode is supported
|
|
819
|
+
* @returns true
|
|
820
|
+
*/
|
|
821
|
+
static get isReadOnlySupported() {
|
|
822
|
+
return !0;
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Get Tool toolbox settings
|
|
826
|
+
* icon - Tool icon's SVG
|
|
827
|
+
* title - title to show in toolbox
|
|
828
|
+
* @returns icon and title of the toolbox
|
|
829
|
+
*/
|
|
830
|
+
static get toolbox() {
|
|
831
|
+
return {
|
|
832
|
+
icon: Re,
|
|
833
|
+
title: "Quote"
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* Empty Quote is not empty Block
|
|
838
|
+
* @returns true
|
|
839
|
+
*/
|
|
840
|
+
static get contentless() {
|
|
841
|
+
return !0;
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Allow to press Enter inside the Quote
|
|
845
|
+
* @returns true
|
|
846
|
+
*/
|
|
847
|
+
static get enableLineBreaks() {
|
|
848
|
+
return !0;
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Default placeholder for quote text
|
|
852
|
+
* @returns 'Enter a quote'
|
|
853
|
+
*/
|
|
854
|
+
static get DEFAULT_QUOTE_PLACEHOLDER() {
|
|
855
|
+
return "Enter a quote";
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
* Default placeholder for quote caption
|
|
859
|
+
* @returns 'Enter a caption'
|
|
860
|
+
*/
|
|
861
|
+
static get DEFAULT_CAPTION_PLACEHOLDER() {
|
|
862
|
+
return "Enter a caption";
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Default quote alignment
|
|
866
|
+
* @returns Alignment.Left
|
|
867
|
+
*/
|
|
868
|
+
static get DEFAULT_ALIGNMENT() {
|
|
869
|
+
return "left";
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Allow Quote to be converted to/from other blocks
|
|
873
|
+
* @returns conversion config object
|
|
874
|
+
*/
|
|
875
|
+
static get conversionConfig() {
|
|
876
|
+
return {
|
|
877
|
+
/**
|
|
878
|
+
* To create Quote data from string, simple fill 'text' property
|
|
879
|
+
*/
|
|
880
|
+
import: "text",
|
|
881
|
+
/**
|
|
882
|
+
* To create string from Quote data, concatenate text and caption
|
|
883
|
+
* @param quoteData - Quote data object
|
|
884
|
+
* @returns string
|
|
885
|
+
*/
|
|
886
|
+
export: function(t) {
|
|
887
|
+
return t.caption ? `${t.text} — ${t.caption}` : t.text;
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
/**
|
|
892
|
+
* Tool`s styles
|
|
893
|
+
* @returns CSS classes names
|
|
894
|
+
*/
|
|
895
|
+
get CSS() {
|
|
896
|
+
return {
|
|
897
|
+
baseClass: this.api.styles.block,
|
|
898
|
+
wrapper: "cdx-quote",
|
|
899
|
+
text: "cdx-quote__text",
|
|
900
|
+
input: this.api.styles.input,
|
|
901
|
+
caption: "cdx-quote__caption"
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* Tool`s settings properties
|
|
906
|
+
* @returns settings properties
|
|
907
|
+
*/
|
|
908
|
+
get settings() {
|
|
909
|
+
return [
|
|
910
|
+
{
|
|
911
|
+
name: "left",
|
|
912
|
+
icon: He
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
name: "center",
|
|
916
|
+
icon: De
|
|
917
|
+
}
|
|
918
|
+
];
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Create Quote Tool container with inputs
|
|
922
|
+
* @returns blockquote DOM element - Quote Tool container
|
|
923
|
+
*/
|
|
924
|
+
render() {
|
|
925
|
+
const t = v.make("blockquote", [
|
|
926
|
+
this.css.baseClass,
|
|
927
|
+
this.css.wrapper
|
|
928
|
+
]), n = v.make("div", [this.css.input, this.css.text], {
|
|
929
|
+
contentEditable: !this.readOnly,
|
|
930
|
+
innerHTML: this.data.text
|
|
931
|
+
}), r = v.make("div", [this.css.input, this.css.caption], {
|
|
932
|
+
contentEditable: !this.readOnly,
|
|
933
|
+
innerHTML: this.data.caption
|
|
934
|
+
});
|
|
935
|
+
return n.dataset.placeholder = this.quotePlaceholder, r.dataset.placeholder = this.captionPlaceholder, t.appendChild(n), t.appendChild(r), t;
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* Extract Quote data from Quote Tool element
|
|
939
|
+
* @param quoteElement - Quote DOM element to save
|
|
940
|
+
* @returns Quote data object
|
|
941
|
+
*/
|
|
942
|
+
save(t) {
|
|
943
|
+
const n = t.querySelector(`.${this.css.text}`), r = t.querySelector(`.${this.css.caption}`);
|
|
944
|
+
return Object.assign(this.data, {
|
|
945
|
+
text: (n == null ? void 0 : n.innerHTML) ?? "",
|
|
946
|
+
caption: (r == null ? void 0 : r.innerHTML) ?? ""
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Sanitizer rules
|
|
951
|
+
* @returns sanitizer rules
|
|
952
|
+
*/
|
|
953
|
+
static get sanitize() {
|
|
954
|
+
return {
|
|
955
|
+
text: {
|
|
956
|
+
br: !0
|
|
957
|
+
},
|
|
958
|
+
caption: {
|
|
959
|
+
br: !0
|
|
960
|
+
},
|
|
961
|
+
alignment: {}
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Create wrapper for Tool`s settings buttons:
|
|
966
|
+
* 1. Left alignment
|
|
967
|
+
* 2. Center alignment
|
|
968
|
+
* @returns settings menu
|
|
969
|
+
*/
|
|
970
|
+
renderSettings() {
|
|
971
|
+
const t = (n) => n && n[0].toUpperCase() + n.slice(1);
|
|
972
|
+
return this.settings.map((n) => ({
|
|
973
|
+
icon: n.icon,
|
|
974
|
+
label: this.api.i18n.t(`Align ${t(n.name)}`),
|
|
975
|
+
onActivate: () => this._toggleTune(n.name),
|
|
976
|
+
isActive: this.data.alignment === n.name,
|
|
977
|
+
closeOnActivate: !0
|
|
978
|
+
}));
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* Toggle quote`s alignment
|
|
982
|
+
* @param tune - alignment
|
|
983
|
+
*/
|
|
984
|
+
_toggleTune(t) {
|
|
985
|
+
this.data.alignment = t, this.block.dispatchChange();
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
export {
|
|
989
|
+
m as default
|
|
990
|
+
};
|