@getdraft/plugin 1.15.1 → 1.16.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.
- package/.turbo/turbo-dev-tsc.log +6 -0
- package/.turbo/turbo-eslint.log +12 -0
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +314 -339
- package/dist/index.es.js.map +1 -1
- package/dist/index.iife.js +2 -2
- package/dist/index.iife.js.map +1 -1
- package/dist/types/types.d.ts +5 -28
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +7 -6
- package/src/plugin.ts +1 -1
- package/src/types.ts +12 -22
- package/vite.config.ts +3 -3
package/dist/index.es.js
CHANGED
|
@@ -1,339 +1,314 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
container: "#draft-plugin-container",
|
|
316
|
-
disableHotkeysPassing: !1,
|
|
317
|
-
locale: "ru",
|
|
318
|
-
on: {}
|
|
319
|
-
};
|
|
320
|
-
class S {
|
|
321
|
-
constructor() {
|
|
322
|
-
a(this, "version", L);
|
|
323
|
-
}
|
|
324
|
-
create(t) {
|
|
325
|
-
return new E({
|
|
326
|
-
..._,
|
|
327
|
-
...t
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
const G = new S();
|
|
332
|
-
window.DraftPlugin = G;
|
|
333
|
-
export {
|
|
334
|
-
k as DraftError,
|
|
335
|
-
H as EditorMenu,
|
|
336
|
-
C as ViewMode,
|
|
337
|
-
G as default
|
|
338
|
-
};
|
|
339
|
-
//# sourceMappingURL=index.es.js.map
|
|
1
|
+
//#region src/routes.ts
|
|
2
|
+
var e = "http://localhost:5174", t = "https://seplugin.sendsay.ru", n;
|
|
3
|
+
(function(e) {
|
|
4
|
+
e.Section = "section", e.Root = "root", e.Column = "column", e.Element = "element";
|
|
5
|
+
})(n ||= {});
|
|
6
|
+
var r;
|
|
7
|
+
(function(e) {
|
|
8
|
+
e.Idle = "idle", e.Hovered = "hovered", e.Faded = "faded", e.Selected = "selected", e.Engaged = "engaged", e.Dragged = "dragged";
|
|
9
|
+
})(r ||= {});
|
|
10
|
+
var i;
|
|
11
|
+
(function(e) {
|
|
12
|
+
e.Audit = "audit", e.Guide = "guide", e.Style = "style", e.Blocks = "blocks";
|
|
13
|
+
})(i ||= {});
|
|
14
|
+
var a;
|
|
15
|
+
(function(e) {
|
|
16
|
+
e.Desktop = "desktop", e.Mobile = "mobile";
|
|
17
|
+
})(a ||= {});
|
|
18
|
+
var o;
|
|
19
|
+
(function(e) {
|
|
20
|
+
e.Normal = "normal", e.Reverse = "reverse", e.Keep = "keep";
|
|
21
|
+
})(o ||= {});
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/types.ts
|
|
24
|
+
var s = class extends Error {
|
|
25
|
+
code;
|
|
26
|
+
constructor(e, t) {
|
|
27
|
+
super(t), this.name = "DraftError", this.code = e;
|
|
28
|
+
}
|
|
29
|
+
}, c = async (e) => {
|
|
30
|
+
try {
|
|
31
|
+
let t = await fetch(e, { method: "HEAD" });
|
|
32
|
+
if (!t.ok) return null;
|
|
33
|
+
let n = t.headers.get("Content-Length");
|
|
34
|
+
return n ? parseInt(n, 10) : null;
|
|
35
|
+
} catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}, l = (e) => new Promise((t, n) => {
|
|
39
|
+
let r = new Image();
|
|
40
|
+
r.onload = async () => {
|
|
41
|
+
let n = await c(e) ?? 0;
|
|
42
|
+
t({
|
|
43
|
+
originalWidth: r.width,
|
|
44
|
+
originalHeight: r.height,
|
|
45
|
+
ratio: r.width / r.height,
|
|
46
|
+
fileSize: n
|
|
47
|
+
});
|
|
48
|
+
}, r.onerror = (e) => {
|
|
49
|
+
n(e);
|
|
50
|
+
}, r.src = e;
|
|
51
|
+
}), u = (e, t) => {
|
|
52
|
+
if (e.length !== 1) return e;
|
|
53
|
+
if (e.charCodeAt(0) >= 880) {
|
|
54
|
+
if (t.indexOf("Key") === 0 && t.length === 4) return t.charAt(3);
|
|
55
|
+
if (t.indexOf("Digit") === 0 && t.length === 6) return t.charAt(5);
|
|
56
|
+
}
|
|
57
|
+
return e;
|
|
58
|
+
}, d = (e) => {
|
|
59
|
+
let t = `${u(e.key, e.code)}`.toLowerCase() || e.key, n = navigator.userAgent.includes("Mac OS");
|
|
60
|
+
t === "backspace" && n && (t = "delete");
|
|
61
|
+
let r = [];
|
|
62
|
+
return (n && e.metaKey || !n && e.ctrlKey) && r.push("mod"), e.shiftKey && r.push("shift"), r.length > 0 && (t = `${r.join("-")}-${u(t, e.code)}`), t;
|
|
63
|
+
}, f = new Set([
|
|
64
|
+
"escape",
|
|
65
|
+
"mod-c",
|
|
66
|
+
"mod-d",
|
|
67
|
+
"mod-z",
|
|
68
|
+
"mod-y",
|
|
69
|
+
"mod-shift-z",
|
|
70
|
+
"mod-v",
|
|
71
|
+
"delete",
|
|
72
|
+
"mod-g",
|
|
73
|
+
"mod-p",
|
|
74
|
+
"mod-s"
|
|
75
|
+
]), p = "@getdraft/plugin", m = "1.16.0", h = {
|
|
76
|
+
name: p,
|
|
77
|
+
version: m,
|
|
78
|
+
main: "dist/index.cjs.js",
|
|
79
|
+
module: "dist/index.es.js",
|
|
80
|
+
types: "dist/types/index.d.ts",
|
|
81
|
+
exports: { ".": {
|
|
82
|
+
types: "./dist/types/index.d.ts",
|
|
83
|
+
import: "./dist/index.es.js",
|
|
84
|
+
require: "./dist/index.cjs.js"
|
|
85
|
+
} },
|
|
86
|
+
scripts: {
|
|
87
|
+
prebuild: "rm -rf dist",
|
|
88
|
+
build: "vite build",
|
|
89
|
+
"dev-tsc": "tsc-check",
|
|
90
|
+
eslint: "npx eslint src",
|
|
91
|
+
"eslint:fix": "pnpm eslint --fix",
|
|
92
|
+
prettify: "npx prettier -w ./",
|
|
93
|
+
prepublish: "pnpm build",
|
|
94
|
+
watch: "NODE_ENV=development vite build --watch",
|
|
95
|
+
start: "NODE_ENV=development npx vite"
|
|
96
|
+
},
|
|
97
|
+
dependencies: { "@getdraft/types": "workspace:^" },
|
|
98
|
+
devDependencies: {
|
|
99
|
+
"@getdraft/eslint-config-ts": "workspace:^",
|
|
100
|
+
"@getdraft/prettier": "workspace:^",
|
|
101
|
+
"vite-plugin-dts": "4.5.4"
|
|
102
|
+
},
|
|
103
|
+
license: "MIT"
|
|
104
|
+
}, g = () => {
|
|
105
|
+
let n = RegExp("(^| )seplugin-dev=([^;]+)"), r = document.cookie.match(n)?.[2].toLowerCase?.();
|
|
106
|
+
if (r === "true") return e;
|
|
107
|
+
if (r?.startsWith("https://")) return r;
|
|
108
|
+
let [i, a] = h.version.split(".");
|
|
109
|
+
return `${t}/v${i}.${a}`;
|
|
110
|
+
}, _ = ({ token: e, pluginId: t, apiUrl: n }) => {
|
|
111
|
+
if (!e) throw Error("No [token] was provided");
|
|
112
|
+
if (!t) throw Error("No [pluginId] was provided");
|
|
113
|
+
if (!n) throw Error("No [apiUrl] was provided");
|
|
114
|
+
}, v = (e) => {
|
|
115
|
+
let t = document.createElement("iframe"), n = new URL(g());
|
|
116
|
+
return n.searchParams.set("parentOrigin", e), t.src = n.toString(), t.setAttribute("style", "height:100%;width:100%;min-width:960px;border:0px;"), t.setAttribute("allow", "clipboard-read; clipboard-write"), t.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms allow-popups allow-downloads"), t;
|
|
117
|
+
}, y = class e {
|
|
118
|
+
iframe = null;
|
|
119
|
+
hotkeysAttached = !1;
|
|
120
|
+
iframeOrigin = null;
|
|
121
|
+
constructor(e) {
|
|
122
|
+
this.config = e;
|
|
123
|
+
}
|
|
124
|
+
captureHotkeysEnabled() {
|
|
125
|
+
return this.config.disableHotkeysPassing !== !0;
|
|
126
|
+
}
|
|
127
|
+
onHostHotkey = (e) => {
|
|
128
|
+
if (!this.captureHotkeysEnabled() || !this.iframe?.contentWindow) return;
|
|
129
|
+
let t = d(e);
|
|
130
|
+
if (!f.has(t)) return;
|
|
131
|
+
let n = e.target;
|
|
132
|
+
if (n && (n.isContentEditable || [
|
|
133
|
+
"INPUT",
|
|
134
|
+
"TEXTAREA",
|
|
135
|
+
"SELECT"
|
|
136
|
+
].includes(n.tagName))) return;
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
let { key: r, ctrlKey: i, metaKey: a, shiftKey: o, altKey: s } = e;
|
|
139
|
+
this.postEvent("hostHotkey", {
|
|
140
|
+
key: r,
|
|
141
|
+
code: e.code,
|
|
142
|
+
metaKey: a,
|
|
143
|
+
ctrlKey: i,
|
|
144
|
+
shiftKey: o,
|
|
145
|
+
altKey: s,
|
|
146
|
+
keyCode: t
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
static HEARTBEAT_TIMEOUT = 4e3;
|
|
150
|
+
promisedIframeMethod(t) {
|
|
151
|
+
let n = null, r = null, i = () => {
|
|
152
|
+
n &&= (clearTimeout(n), null), r &&= (window.removeEventListener("message", r, !0), null);
|
|
153
|
+
}, a = new Promise((a, o) => {
|
|
154
|
+
let c = () => {
|
|
155
|
+
n && clearTimeout(n), n = setTimeout(() => {
|
|
156
|
+
i(), o(new s("timeout_error", `Action "${t}" timed out`));
|
|
157
|
+
}, e.HEARTBEAT_TIMEOUT);
|
|
158
|
+
};
|
|
159
|
+
r = (e) => {
|
|
160
|
+
if (e.source !== this.iframe?.contentWindow) return;
|
|
161
|
+
let { data: n } = e;
|
|
162
|
+
if (n.source === "DraftPlugin") {
|
|
163
|
+
if (n.event === "actionPing" && n.action === t) {
|
|
164
|
+
e.stopPropagation(), c();
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (n.event === t) {
|
|
168
|
+
e.stopPropagation(), i();
|
|
169
|
+
let { source: t, event: r, ok: c, code: l, message: u, ...d } = n;
|
|
170
|
+
c === !1 ? o(new s(l || "unknown_error", u || "Unknown error")) : a(d);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}, window.addEventListener("message", r, !0), c();
|
|
174
|
+
});
|
|
175
|
+
return this.postEvent(t), a;
|
|
176
|
+
}
|
|
177
|
+
postEvent(e, t = {}) {
|
|
178
|
+
if (this.iframe && this.iframe.contentWindow && this.iframeOrigin) this.iframe.contentWindow.postMessage({
|
|
179
|
+
...t,
|
|
180
|
+
event: e,
|
|
181
|
+
source: "DraftPlugin"
|
|
182
|
+
}, this.iframeOrigin);
|
|
183
|
+
else if (!this.iframeOrigin) throw Error("Iframe origin is not initialized");
|
|
184
|
+
}
|
|
185
|
+
onImageUpload = async ({ id: e, ...t }) => {
|
|
186
|
+
try {
|
|
187
|
+
let n = await this.config.on.uploadImage?.(t), r = {};
|
|
188
|
+
n && (r = await l(n)), this.postEvent("imageUploaded", {
|
|
189
|
+
id: e,
|
|
190
|
+
img: {
|
|
191
|
+
...r,
|
|
192
|
+
url: n
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
} catch {
|
|
196
|
+
this.postEvent("imageUploaded", { id: e });
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
onLoadPersonalization = async () => {
|
|
200
|
+
try {
|
|
201
|
+
if (!this.config.on.loadPersonalization) throw Error("No personalization loader provided");
|
|
202
|
+
let e = await this.config.on.loadPersonalization();
|
|
203
|
+
this.postEvent("loadPersonalization", { items: e });
|
|
204
|
+
} catch {
|
|
205
|
+
this.postEvent("loadPersonalization", {});
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
onGalleryOpen = async ({ id: e }) => {
|
|
209
|
+
this.config.on.openGallery?.(async (t) => {
|
|
210
|
+
let n = { url: t };
|
|
211
|
+
if (t) {
|
|
212
|
+
let e = await l(t);
|
|
213
|
+
Object.assign(n, e);
|
|
214
|
+
}
|
|
215
|
+
this.postEvent("imageUploaded", {
|
|
216
|
+
id: e,
|
|
217
|
+
img: n
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
triggerEvent(e, t) {
|
|
222
|
+
if (e) return e(t);
|
|
223
|
+
}
|
|
224
|
+
onMessage = (e) => {
|
|
225
|
+
if (e.source !== this.iframe?.contentWindow) return;
|
|
226
|
+
let { data: { source: t, event: n, ...r } } = e;
|
|
227
|
+
t === "DraftPlugin" && (n === "openGallery" ? this.onGalleryOpen(r) : n === "uploadImage" ? this.onImageUpload(r) : n === "loadPersonalization" ? this.onLoadPersonalization() : this.triggerEvent(this.config.on[n], r));
|
|
228
|
+
};
|
|
229
|
+
start({ template: e, templateName: t, uid: n }) {
|
|
230
|
+
let r = document.querySelector(this.config.container);
|
|
231
|
+
if (r) {
|
|
232
|
+
let i = (r) => {
|
|
233
|
+
let { data: { source: a, event: o } } = r;
|
|
234
|
+
if (a === "DraftPlugin" && o === "loaded") {
|
|
235
|
+
if (r.source !== this.iframe?.contentWindow) return;
|
|
236
|
+
this.iframeOrigin = r.origin;
|
|
237
|
+
let { on: a, container: o, locale: s, autosave: c, token: l, apiUrl: u, pluginId: d, authData: f, __config: p } = this.config;
|
|
238
|
+
_(this.config), this.iframe && this.iframe.contentWindow && this.postEvent("init", {
|
|
239
|
+
container: o,
|
|
240
|
+
locale: s,
|
|
241
|
+
uid: n,
|
|
242
|
+
autosave: c,
|
|
243
|
+
token: l,
|
|
244
|
+
pluginId: d,
|
|
245
|
+
authData: f,
|
|
246
|
+
apiUrl: u,
|
|
247
|
+
__config: p,
|
|
248
|
+
enabledListeners: Object.keys(a),
|
|
249
|
+
template: e,
|
|
250
|
+
templateName: t
|
|
251
|
+
}), window.addEventListener("message", this.onMessage), window.removeEventListener("message", i);
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
this.iframe = v(window.location.origin), window.addEventListener("message", i), r.appendChild(this.iframe), this.captureHotkeysEnabled() && !this.hotkeysAttached && (window.addEventListener("keydown", this.onHostHotkey), this.hotkeysAttached = !0);
|
|
255
|
+
} else throw Error("Specified container not found");
|
|
256
|
+
}
|
|
257
|
+
destroy = () => {
|
|
258
|
+
this.iframe?.remove(), this.iframe = null, window.removeEventListener("message", this.onMessage), this.hotkeysAttached &&= (window.removeEventListener("keydown", this.onHostHotkey), !1);
|
|
259
|
+
};
|
|
260
|
+
changeTemplate(e, t = {}) {
|
|
261
|
+
this.postEvent("changeTemplate", {
|
|
262
|
+
...t,
|
|
263
|
+
template: e
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
toggleGrid(e) {
|
|
267
|
+
this.postEvent("toggleGrid", { state: e });
|
|
268
|
+
}
|
|
269
|
+
togglePreview(e) {
|
|
270
|
+
this.postEvent("togglePreview", { state: e });
|
|
271
|
+
}
|
|
272
|
+
toggleMenu(e = null) {
|
|
273
|
+
this.postEvent("toggleMenu", { menu: e });
|
|
274
|
+
}
|
|
275
|
+
toggleViewMode(e) {
|
|
276
|
+
this.postEvent("toggleViewMode", { viewMode: e });
|
|
277
|
+
}
|
|
278
|
+
undo() {
|
|
279
|
+
this.postEvent("undo");
|
|
280
|
+
}
|
|
281
|
+
redo() {
|
|
282
|
+
this.postEvent("redo");
|
|
283
|
+
}
|
|
284
|
+
save() {
|
|
285
|
+
return this.promisedIframeMethod("saveAction");
|
|
286
|
+
}
|
|
287
|
+
exit() {
|
|
288
|
+
return this.promisedIframeMethod("exitAction");
|
|
289
|
+
}
|
|
290
|
+
exportContent() {
|
|
291
|
+
return this.promisedIframeMethod("exportContent");
|
|
292
|
+
}
|
|
293
|
+
exportAsFile() {
|
|
294
|
+
return this.promisedIframeMethod("exportAsFile");
|
|
295
|
+
}
|
|
296
|
+
}, b = {
|
|
297
|
+
container: "#draft-plugin-container",
|
|
298
|
+
disableHotkeysPassing: !1,
|
|
299
|
+
locale: "ru",
|
|
300
|
+
on: {}
|
|
301
|
+
}, x = new class {
|
|
302
|
+
version = m;
|
|
303
|
+
create(e) {
|
|
304
|
+
return new y({
|
|
305
|
+
...b,
|
|
306
|
+
...e
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
}();
|
|
310
|
+
window.DraftPlugin = x;
|
|
311
|
+
//#endregion
|
|
312
|
+
export { s as DraftError, i as EditorMenu, a as ViewMode, x as default };
|
|
313
|
+
|
|
314
|
+
//# sourceMappingURL=index.es.js.map
|