Skip to content

Commit 9074402

Browse files
committed
fix: 🐛 confirm button does not close the editor
closed #25
1 parent 3a32f8a commit 9074402

File tree

4 files changed

+61
-16
lines changed

4 files changed

+61
-16
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@ant-design/icons": "^4.7.0",
1919
"@babel/core": "7.12.3",
2020
"@craco/craco": "^6.3.0",
21-
"@logseq/libs": "^0.0.15",
21+
"@logseq/libs": "^0.0.17",
2222
"@pmmmwh/react-refresh-webpack-plugin": "0.4.3",
2323
"@svgr/webpack": "5.5.0",
2424
"@tailwindcss/postcss7-compat": "^2.2.17",

src/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import './index.css'
1212

1313
const logseq = window.logseq
1414
const logseqEditor = logseq.Editor
15-
const logseqApp = logseq.App
1615

1716
const isInBrowser = process.env.REACT_APP_ENV === 'browser'
1817
const bootEditor = (input, blockId) => {
@@ -40,7 +39,7 @@ if (isInBrowser) {
4039
console.log('[faiz:] === block', block)
4140
const { format, content } = block
4241
// only support markdown
43-
if (format !== 'markdown') return logseqApp.UI.showMsg(i18n.t('Markdown table editor only support markdown'), 'warning')
42+
if (format !== 'markdown') return logseq.UI.showMsg(i18n.t('Markdown table editor only support markdown'), 'warning')
4443

4544
bootEditor(content, e.uuid)
4645

src/pages/App.jsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import './App.css'
99
import { useTranslation } from 'react-i18next'
1010

1111
const logseq = window.logseq
12-
const logseqApp = logseq.App
1312
const logseqEditor = logseq.Editor
1413

1514
const isInBrowser = process.env.REACT_APP_ENV === 'browser'
@@ -28,7 +27,7 @@ const App = ({ content, tables, blockId }) => {
2827
}
2928

3029
const onClickConfirm = () => {
31-
if (!blockId && !isInBrowser) return logseqApp.UI.showMsg(t('uuid error'))
30+
if (!blockId && !isInBrowser) return logseq.UI.showMsg(t('uuid error'))
3231
const markdownContent = arrAfterSplitByTable.map((node, index) => {
3332
if (node.type === 'table') {
3433
const slateVal = tableEditorMapRef.current?.[index]?.getEditorValue()?.[0]
@@ -41,11 +40,11 @@ const App = ({ content, tables, blockId }) => {
4140

4241
logseqEditor.updateBlock(blockId, markdownContent)
4342
.then(() => {
44-
logseqApp.UI.showMsg(t('markdown table overwrite success'))
4543
logseq.hideMainUI()
44+
logseq.UI.showMsg(t('markdown table overwrite success'))
4645
})
4746
.catch(err => {
48-
logseqApp.UI.showMsg(t('markdown table overwrite error'), 'warning')
47+
logseq.UI.showMsg(t('markdown table overwrite error'), 'warning')
4948
console.log('[faiz:] === onClickConfirm error', err)
5049
})
5150
}

yarn.lock

+56-9
Original file line numberDiff line numberDiff line change
@@ -1544,13 +1544,14 @@
15441544
"@types/yargs" "^16.0.0"
15451545
chalk "^4.0.0"
15461546

1547-
"@logseq/libs@^0.0.15":
1548-
version "0.0.15"
1549-
resolved "https://registry.yarnpkg.com/@logseq/libs/-/libs-0.0.15.tgz#03b8b81a0a1557e3f022d68c978ddcb501cd4421"
1550-
integrity sha512-Z4YrYGfu8Y3s9LTqVnPGkxlO+KZtP1YalH/A63zYgxP61cV5QtKlnHWNcjsKxsD5CkaSL4MlSN4mf7wNx/Fm0A==
1547+
"@logseq/libs@^0.0.17":
1548+
version "0.0.17"
1549+
resolved "https://registry.yarnpkg.com/@logseq/libs/-/libs-0.0.17.tgz#245cdabc2d1bc3ec6164d406349c5c649a040031"
1550+
integrity sha512-SkzzAaocmrgeHYrCOaRyEqzPOxw3d0qVEZSrt9qVvXE4tuEgbvEHR8tzI1N5RjgAv+PDWuGPiP7/mhcXHpINEw==
15511551
dependencies:
15521552
csstype "3.1.0"
15531553
debug "4.3.4"
1554+
deepmerge "4.3.1"
15541555
dompurify "2.3.8"
15551556
eventemitter3 "4.0.7"
15561557
fast-deep-equal "3.1.3"
@@ -1961,7 +1962,7 @@
19611962
"@svgr/plugin-svgo" "^5.5.0"
19621963
loader-utils "^2.0.0"
19631964

1964-
"@tailwindcss/postcss7-compat@^2.2.17", "tailwindcss@npm:@tailwindcss/postcss7-compat":
1965+
"@tailwindcss/postcss7-compat@^2.2.17":
19651966
version "2.2.17"
19661967
resolved "https://registry.yarnpkg.com/@tailwindcss/postcss7-compat/-/postcss7-compat-2.2.17.tgz#dc78f3880a2af84163150ff426a39e42b9ae8922"
19671968
integrity sha512-3h2svqQAqYHxRZ1KjsJjZOVTQ04m29LjfrLjXyZZEJuvUuJN+BCIF9GI8vhE1s0plS0mogd6E6YLg6mu4Wv/Vw==
@@ -4700,6 +4701,11 @@ deep-is@^0.1.3, deep-is@~0.1.3:
47004701
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831"
47014702
integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==
47024703

4704+
deepmerge@4.3.1:
4705+
version "4.3.1"
4706+
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a"
4707+
integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==
4708+
47034709
deepmerge@^4.2.2:
47044710
version "4.2.2"
47054711
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955"
@@ -6805,7 +6811,7 @@ inherits@2.0.1:
68056811
inherits@2.0.3:
68066812
version "2.0.3"
68076813
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
6808-
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
6814+
integrity sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==
68096815

68106816
ini@^1.3.5, ini@~1.3.0:
68116817
version "1.3.8"
@@ -12638,6 +12644,47 @@ table@^6.0.9:
1263812644
string-width "^4.2.3"
1263912645
strip-ansi "^6.0.1"
1264012646

12647+
"tailwindcss@npm:@tailwindcss/postcss7-compat":
12648+
version "2.2.17"
12649+
resolved "https://registry.yarnpkg.com/@tailwindcss/postcss7-compat/-/postcss7-compat-2.2.17.tgz#dc78f3880a2af84163150ff426a39e42b9ae8922"
12650+
integrity sha512-3h2svqQAqYHxRZ1KjsJjZOVTQ04m29LjfrLjXyZZEJuvUuJN+BCIF9GI8vhE1s0plS0mogd6E6YLg6mu4Wv/Vw==
12651+
dependencies:
12652+
arg "^5.0.1"
12653+
autoprefixer "^9"
12654+
bytes "^3.0.0"
12655+
chalk "^4.1.2"
12656+
chokidar "^3.5.2"
12657+
color "^4.0.1"
12658+
cosmiconfig "^7.0.1"
12659+
detective "^5.2.0"
12660+
didyoumean "^1.2.2"
12661+
dlv "^1.1.3"
12662+
fast-glob "^3.2.7"
12663+
fs-extra "^10.0.0"
12664+
glob-parent "^6.0.1"
12665+
html-tags "^3.1.0"
12666+
is-color-stop "^1.1.0"
12667+
is-glob "^4.0.1"
12668+
lodash "^4.17.21"
12669+
lodash.topath "^4.5.2"
12670+
modern-normalize "^1.1.0"
12671+
node-emoji "^1.11.0"
12672+
normalize-path "^3.0.0"
12673+
object-hash "^2.2.0"
12674+
postcss "^7"
12675+
postcss-functions "^3"
12676+
postcss-js "^2"
12677+
postcss-load-config "^3.1.0"
12678+
postcss-nested "^4"
12679+
postcss-selector-parser "^6.0.6"
12680+
postcss-value-parser "^4.1.0"
12681+
pretty-hrtime "^1.0.3"
12682+
purgecss "^4.0.3"
12683+
quick-lru "^5.1.1"
12684+
reduce-css-calc "^2.1.8"
12685+
resolve "^1.20.0"
12686+
tmp "^0.2.1"
12687+
1264112688
tapable@^1.0.0, tapable@^1.1.3:
1264212689
version "1.1.3"
1264312690
resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2"
@@ -12919,9 +12966,9 @@ tslib@^1.8.1:
1291912966
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
1292012967

1292112968
tslib@^2.0.3:
12922-
version "2.3.1"
12923-
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
12924-
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
12969+
version "2.6.2"
12970+
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
12971+
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==
1292512972

1292612973
tsutils@^3.17.1, tsutils@^3.21.0:
1292712974
version "3.21.0"

0 commit comments

Comments
 (0)