-
-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update(tune): cast it into boolean instead
- Loading branch information
1 parent
5ce4814
commit 6699206
Showing
2 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Editor.js with ImageTool</title> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest/dist/editor.css"> | ||
</head> | ||
<body> | ||
<div id="editorjs"></div> | ||
<script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/@editorjs/header@latest"></script> | ||
<script src="./dist/image.umd.js"></script> | ||
<script> | ||
document.addEventListener('DOMContentLoaded', () => { | ||
const editor = new EditorJS({ | ||
holder: 'editorjs', | ||
tools: { | ||
header: { | ||
class: Header, | ||
inlineToolbar: ['link'], | ||
config: { | ||
placeholder: 'Enter a header' | ||
}, | ||
shortcut: 'CMD+SHIFT+H' | ||
}, | ||
image: { | ||
class: ImageTool, | ||
config: { | ||
endpoints: { | ||
byFile: 'http://localhost:3000/uploadFile', // Your backend file uploader endpoint | ||
byUrl: 'http://localhost:3000/fetchUrl', // Your endpoint that provides file by URL | ||
}, | ||
field: 'image', // Form field name for the image file | ||
types: 'image/*', // Image file types | ||
} | ||
} | ||
}, | ||
data: { | ||
blocks: [ | ||
{ | ||
type: "header", | ||
data: { | ||
text: "Welcome to Editor.js", | ||
level: 2 | ||
} | ||
}, | ||
{ | ||
type: "image", | ||
data: { | ||
file: { | ||
url: "http://localhost:5500/dev/.tmp/b623408975649d125bec4bf02.png" // Replace with your image URL | ||
}, | ||
caption: "Sample image", | ||
withBorder: true, | ||
withBackground: false, | ||
stretched: false | ||
} | ||
} | ||
] | ||
} | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters