Skip to content

Commit 03b90f4

Browse files
committed
feat: Install dialog-polyfill
1 parent cbc2ba6 commit 03b90f4

File tree

5 files changed

+30
-2
lines changed

5 files changed

+30
-2
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,19 @@ Please see also [this comment](https://github.com/codex-team/editor.js/issues/12
4848

4949
## <dialog> polyfill
5050

51-
editorjs-layout uses `<dialog>` element.
52-
[GoogleChrome/dialog-polyfill](https://github.com/GoogleChrome/dialog-polyfill) can be used to improve the browser compatibility.
51+
editorjs-layout uses `<dialog>` element and [GoogleChrome/dialog-polyfill](https://github.com/GoogleChrome/dialog-polyfill).
52+
Please load `dialog-polyfill.css` in your document.
53+
54+
```html
55+
<head>
56+
<link
57+
rel="stylesheet"
58+
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/dialog-polyfill.css"
59+
integrity="sha256-hT0ET4tfm+7MyjeBepBgV2N5tOmsAVKcTWhH82jvoaA="
60+
crossorigin="anonymous"
61+
/>
62+
</head>
63+
```
5364

5465
## Build
5566

docs/index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
<html>
33
<head>
44
<meta charset="utf-8" />
5+
56
<title>editorjs-layout</title>
7+
8+
<link
9+
rel="stylesheet"
10+
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/dialog-polyfill.css"
11+
integrity="sha256-hT0ET4tfm+7MyjeBepBgV2N5tOmsAVKcTWhH82jvoaA="
12+
crossorigin="anonymous"
13+
/>
614
</head>
715

816
<body>

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
},
3333
"devDependencies": {
3434
"@types/uuid": "^8.3.0",
35+
"dialog-polyfill": "^0.5.6",
3536
"ionicons": "^5.3.0",
3637
"license-checker": "^25.0.1",
3738
"prettier": "^2.2.1",

src/itemContent/createDialog.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { OutputData } from "@editorjs/editorjs";
2+
import dialogPolyfill from "dialog-polyfill";
23
import { v4 as uuidv4 } from "uuid";
34
import type { LayoutBlockToolConfig } from "../LayoutBlockTool";
45

@@ -15,6 +16,8 @@ const createDialog = ({
1516
}) => {
1617
const dialog = document.createElement("dialog");
1718

19+
dialogPolyfill.registerDialog(dialog);
20+
1821
dialog.style.maxWidth = "960px";
1922
// Make be not able to click inner
2023
dialog.style.padding = "0";

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,6 +1342,11 @@ dezalgo@^1.0.0, dezalgo@~1.0.3:
13421342
asap "^2.0.0"
13431343
wrappy "1"
13441344

1345+
dialog-polyfill@^0.5.6:
1346+
version "0.5.6"
1347+
resolved "https://registry.yarnpkg.com/dialog-polyfill/-/dialog-polyfill-0.5.6.tgz#7507b4c745a82fcee0fa07ce64d835979719599a"
1348+
integrity sha512-ZbVDJI9uvxPAKze6z146rmfUZjBqNEwcnFTVamQzXH+svluiV7swmVIGr7miwADgfgt1G2JQIytypM9fbyhX4w==
1349+
13451350
dir-glob@^3.0.0, dir-glob@^3.0.1:
13461351
version "3.0.1"
13471352
resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f"

0 commit comments

Comments
 (0)