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