Skip to content

Commit

Permalink
fix: Remove dialog-polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
hata6502 committed Apr 19, 2022
1 parent fdffb4a commit 5d8cb8e
Show file tree
Hide file tree
Showing 6 changed files with 823 additions and 562 deletions.
16 changes: 0 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,6 @@ Copied block data by `ctrl+c` are not [validated](https://editorjs.io/blockapi#m
So copied block data and output block data may be different.
Please see also [this comment](https://github.com/codex-team/editor.js/issues/1280#issuecomment-706482368).

## <dialog> polyfill

editorjs-layout uses `<dialog>` element and [GoogleChrome/dialog-polyfill](https://github.com/GoogleChrome/dialog-polyfill).
Please load `dialog-polyfill.css` in your document.

```html
<head>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/dialog-polyfill.css"
integrity="sha256-hT0ET4tfm+7MyjeBepBgV2N5tOmsAVKcTWhH82jvoaA="
crossorigin="anonymous"
/>
</head>
```

## Build

```sh
Expand Down
13 changes: 2 additions & 11 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@
<html>
<head>
<meta charset="utf-8" />

<title>editorjs-layout</title>

<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/dialog-polyfill.css"
integrity="sha256-hT0ET4tfm+7MyjeBepBgV2N5tOmsAVKcTWhH82jvoaA="
crossorigin="anonymous"
/>
</head>

<body>
Expand Down Expand Up @@ -162,9 +154,8 @@
document.querySelector("#button").addEventListener("click", async () => {
const outputData = await editorJS.save();

document.querySelector("#output-data").textContent = JSON.stringify(
outputData
);
document.querySelector("#output-data").textContent =
JSON.stringify(outputData);
});

new EditorJS({
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
},
"devDependencies": {
"@types/uuid": "^8.3.0",
"dialog-polyfill": "^0.5.6",
"ionicons": "^5.3.0",
"license-checker": "^25.0.1",
"prettier": "^2.2.1",
Expand Down
4 changes: 1 addition & 3 deletions src/itemContent/createDialog.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { OutputData } from "@editorjs/editorjs";
import dialogPolyfill from "dialog-polyfill";
import { v4 as uuidv4 } from "uuid";
import type { LayoutBlockToolConfig } from "../LayoutBlockTool";

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

dialogPolyfill.registerDialog(dialog);

dialog.style.maxWidth = "960px";
// Make be not able to click inner
dialog.style.padding = "0";
Expand All @@ -41,6 +38,7 @@ const createDialog = ({
return;
}

// @ts-expect-error
dialog.close();
};

Expand Down
1 change: 1 addition & 0 deletions src/itemContent/itemContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const renderItemContent = ({
});

document.body.append(dialog);
// @ts-expect-error
dialog.showModal();
});
}
Expand Down
Loading

0 comments on commit 5d8cb8e

Please sign in to comment.