Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit1a5bb34

Browse files
committed
chore(editor-js): basic code hightlight prototype
1 parent8c681a0 commit1a5bb34

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
},
4242
"dependencies": {
4343
"@editorjs/checklist":"^1.1.0",
44+
"@editorjs/code":"^2.4.1",
4445
"@editorjs/delimiter":"^1.1.0",
4546
"@editorjs/editorjs":"^2.15.0",
4647
"@editorjs/header":"^2.3.0",

‎src/containers/RichEditor/logic.js‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ import Marker from '@editorjs/marker'
66
importChecklistfrom'@editorjs/checklist'
77
importDelimiterfrom'@editorjs/delimiter'
88
importInlineCodefrom'@editorjs/inline-code'
9+
importCodeToolfrom'@editorjs/code'
10+
911
importHeaderfrom'@groupher/editor-header'
1012
importQuotefrom'@groupher/editor-quote'
1113
importLinkToolfrom'@groupher/editor-link'
1214

15+
importPrismfrom'mastani-codehighlight'
16+
1317
// import { TYPE, EVENT, ERR } from '@constant'
1418
import{buildLog}from'@utils'
1519

@@ -36,7 +40,7 @@ export const useInit = (_store, loaded) => {
3640

3741
if(loaded){
3842
// eslint-disable-next-line
39-
newEditorJS({
43+
consteditor=newEditorJS({
4044
/**
4145
* Id of Element that should contain Editor instance
4246
*/
@@ -63,6 +67,7 @@ export const useInit = (_store, loaded) => {
6367
endpoint:'http://localhost:4001/api/og-info',
6468
},
6569
},
70+
code:CodeTool,
6671
},
6772
data:{
6873
time:1552744582955,
@@ -76,6 +81,13 @@ export const useInit = (_store, loaded) => {
7681
],
7782
version:'2.11.10',
7883
},
84+
onChange:()=>{
85+
console.log('onChange data: ')
86+
editor.save().then(data=>{
87+
console.log('onChange data: ',data)
88+
Prism.highlightAll()
89+
})
90+
},
7991
})
8092
}
8193

‎yarn.lock‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,11 @@
979979
version "1.1.0"
980980
resolved "https://registry.npmjs.org/@editorjs/checklist/-/checklist-1.1.0.tgz#1c5a083a48852f3d86d6086d2e1a6057ac5b0429"
981981

982+
"@editorjs/code@^2.4.1":
983+
version "2.4.1"
984+
resolved "https://registry.yarnpkg.com/@editorjs/code/-/code-2.4.1.tgz#a1851c781c9ead9a84bd921f04df172a2383f550"
985+
integrity sha512-R4UUApkm6FLuxrQoqISg6GL73t0WWOdoPdAmAa36xarmtmBRkxu4AfxIwzW2CtUD1CqG1T7Be6jnv4ZeUoMNYQ==
986+
982987
"@editorjs/delimiter@^1.1.0":
983988
version "1.1.0"
984989
resolved "https://registry.npmjs.org/@editorjs/delimiter/-/delimiter-1.1.0.tgz#f61808ea92e4e289607d54441964f1cb8605410a"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp