@milkdown/crepe 7.4.0 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/{_view-TbSIR42F.js → _view-N32ied53.js} +2 -2
- package/lib/cjs/{_view-TbSIR42F.js.map → _view-N32ied53.js.map} +1 -1
- package/lib/cjs/clsx-dASsG01A.js +6 -0
- package/lib/cjs/clsx-dASsG01A.js.map +1 -0
- package/lib/cjs/{composed-offset-position.browser.min-FwypoGc1.js → floating-ui.dom-2cjBpir5.js} +14 -18
- package/lib/cjs/floating-ui.dom-2cjBpir5.js.map +1 -0
- package/lib/cjs/helper-1aludV1Z.js +15 -0
- package/lib/cjs/helper-1aludV1Z.js.map +1 -0
- package/lib/cjs/{index-tbEq3xma.js → index--sa4NMpW.js} +15 -14
- package/lib/cjs/{index-tbEq3xma.js.map → index--sa4NMpW.js.map} +1 -1
- package/lib/cjs/{index-5PcT4iSf.js → index--tnUmqZ_.js} +18 -17
- package/lib/cjs/{index-5PcT4iSf.js.map → index--tnUmqZ_.js.map} +1 -1
- package/lib/cjs/{index-i0_v2uVp.js → index-1vHyMXH8.js} +15 -14
- package/lib/{esm/index-4QzlLVWs.js.map → cjs/index-1vHyMXH8.js.map} +1 -1
- package/lib/cjs/index-28q261C7.js +448 -0
- package/lib/cjs/index-28q261C7.js.map +1 -0
- package/lib/cjs/{index-mJ47ZWO2.js → index-55VIM-52.js} +18 -17
- package/lib/{esm/index-Grquo08f.js.map → cjs/index-55VIM-52.js.map} +1 -1
- package/lib/cjs/{index-lrFGGa_l.js → index-92bwto5V.js} +15 -14
- package/lib/cjs/{index-lrFGGa_l.js.map → index-92bwto5V.js.map} +1 -1
- package/lib/cjs/{index-2oxl5Zo4.js → index-Buu2tD9O.js} +45 -62
- package/lib/cjs/index-Buu2tD9O.js.map +1 -0
- package/lib/cjs/{index-OA_u95ey.js → index-E4Ist86Z.js} +15 -14
- package/lib/{esm/index-7BVeXLQZ.js.map → cjs/index-E4Ist86Z.js.map} +1 -1
- package/lib/cjs/{index-OIQn1x0L.js → index-FbNqlZU8.js} +14 -13
- package/lib/cjs/index-FbNqlZU8.js.map +1 -0
- package/lib/cjs/{index-SxWWV8XD.js → index-HH5lPgpj.js} +18 -17
- package/lib/cjs/{index-SxWWV8XD.js.map → index-HH5lPgpj.js.map} +1 -1
- package/lib/cjs/{index-vlxA_KJ8.js → index-J1-yHn7v.js} +15 -14
- package/lib/{esm/index-vwrMVELn.js.map → cjs/index-J1-yHn7v.js.map} +1 -1
- package/lib/cjs/{index-xqKfEyRA.js → index-J3XY9IPt.js} +12 -7
- package/lib/cjs/index-J3XY9IPt.js.map +1 -0
- package/lib/cjs/{index-llNS_EuP.js → index-Jztk6JlP.js} +58 -55
- package/lib/cjs/index-Jztk6JlP.js.map +1 -0
- package/lib/cjs/{index-O3vRXWIP.js → index-N6pPZY61.js} +22 -30
- package/lib/cjs/index-N6pPZY61.js.map +1 -0
- package/lib/cjs/{index-GKolgvC5.js → index-TUJs6KKL.js} +35 -68
- package/lib/cjs/index-TUJs6KKL.js.map +1 -0
- package/lib/cjs/{index-OtaMLv5l.js → index-Tjg8KyK7.js} +15 -14
- package/lib/cjs/{index-OtaMLv5l.js.map → index-Tjg8KyK7.js.map} +1 -1
- package/lib/cjs/{index-qRg5-QJH.js → index-VYwHTL3F.js} +16 -15
- package/lib/cjs/{index-qRg5-QJH.js.map → index-VYwHTL3F.js.map} +1 -1
- package/lib/cjs/index-_GOdKqUK.js +1147 -0
- package/lib/cjs/index-_GOdKqUK.js.map +1 -0
- package/lib/cjs/{index-PF7s7DOo.js → index-cKQcw-eu.js} +2 -2
- package/lib/cjs/{index-PF7s7DOo.js.map → index-cKQcw-eu.js.map} +1 -1
- package/lib/cjs/{index-fkT0ywfA.js → index-c_OzudR7.js} +15 -14
- package/lib/{esm/index-L7VXk-jT.js.map → cjs/index-c_OzudR7.js.map} +1 -1
- package/lib/cjs/{index-TEjdwq--.js → index-cb-5m0vG.js} +18 -17
- package/lib/cjs/index-cb-5m0vG.js.map +1 -0
- package/lib/cjs/index-cpC-j5Nt.js +176 -0
- package/lib/cjs/index-cpC-j5Nt.js.map +1 -0
- package/lib/cjs/index-crv_k6dv.js +1353 -0
- package/lib/cjs/index-crv_k6dv.js.map +1 -0
- package/lib/cjs/{index-78P4PeZ9.js → index-jlfsu92T.js} +16 -15
- package/lib/{esm/index-4oMdufW4.js.map → cjs/index-jlfsu92T.js.map} +1 -1
- package/lib/cjs/{index-de3dfsQr.js → index-jn036wuh.js} +17 -16
- package/lib/{esm/index-rwcSpYkt.js.map → cjs/index-jn036wuh.js.map} +1 -1
- package/lib/cjs/{index-JAqL0ybh.js → index-kqz-P6o6.js} +9 -9
- package/lib/cjs/index-kqz-P6o6.js.map +1 -0
- package/lib/cjs/{index-t_GA5F26.js → index-lBumFRUQ.js} +15 -14
- package/lib/cjs/{index-t_GA5F26.js.map → index-lBumFRUQ.js.map} +1 -1
- package/lib/cjs/{index-LdEYPSZc.js → index-lUNj3xuC.js} +15 -14
- package/lib/{esm/index-0khVa44f.js.map → cjs/index-lUNj3xuC.js.map} +1 -1
- package/lib/cjs/{index-ortUqbAp.js → index-mcxgNBq9.js} +15 -14
- package/lib/cjs/{index-ortUqbAp.js.map → index-mcxgNBq9.js.map} +1 -1
- package/lib/cjs/{index-GEIgbcVc.js → index-nTfDKYYi.js} +38 -37
- package/lib/{esm/index-NmjiRA0M.js.map → cjs/index-nTfDKYYi.js.map} +1 -1
- package/lib/cjs/{index-kNI3S3lF.js → index-tBw4NmwY.js} +11779 -404
- package/lib/cjs/index-tBw4NmwY.js.map +1 -0
- package/lib/cjs/{index-zBr61zy6.js → index-vfzLCXfi.js} +15 -14
- package/lib/cjs/{index-zBr61zy6.js.map → index-vfzLCXfi.js.map} +1 -1
- package/lib/cjs/{index-w9buMrFW.js → index-von4W2LG.js} +18 -17
- package/lib/cjs/{index-w9buMrFW.js.map → index-von4W2LG.js.map} +1 -1
- package/lib/cjs/index-z6pe2alg.js.map +1 -1
- package/lib/cjs/{index-wXLifZgm.js → index-zXSAHvAj.js} +2 -2
- package/lib/cjs/{index-wXLifZgm.js.map → index-zXSAHvAj.js.map} +1 -1
- package/lib/cjs/index.js +7 -6
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/{schema-7d3meDfB.js → schema-RVrwDDcq.js} +4 -4
- package/lib/cjs/{schema-7d3meDfB.js.map → schema-RVrwDDcq.js.map} +1 -1
- package/lib/cjs/todoList-Ze4FLMlx.js +415 -0
- package/lib/cjs/todoList-Ze4FLMlx.js.map +1 -0
- package/lib/cjs/{tooltip-plugin-Mk9fRTxI.js → tooltip-plugin--lhebztC.js} +15 -24
- package/lib/cjs/tooltip-plugin--lhebztC.js.map +1 -0
- package/lib/esm/{_view-JjtfhQ8k.js → _view-IlZC8FA6.js} +2 -2
- package/lib/esm/{_view-JjtfhQ8k.js.map → _view-IlZC8FA6.js.map} +1 -1
- package/lib/esm/clsx-RxCLxYpD.js +4 -0
- package/lib/esm/clsx-RxCLxYpD.js.map +1 -0
- package/lib/esm/{composed-offset-position.browser.min-Tnm31e-m.js → floating-ui.dom-CAYjY8Gv.js} +15 -17
- package/lib/esm/floating-ui.dom-CAYjY8Gv.js.map +1 -0
- package/lib/esm/helper-wZAtC67x.js +13 -0
- package/lib/esm/helper-wZAtC67x.js.map +1 -0
- package/lib/esm/{index-Bg5GFp0g.js → index-0-j8Icms.js} +2 -2
- package/lib/esm/{index-Bg5GFp0g.js.map → index-0-j8Icms.js.map} +1 -1
- package/lib/esm/{index-4oMdufW4.js → index-1l-61HI-.js} +16 -15
- package/lib/{cjs/index-78P4PeZ9.js.map → esm/index-1l-61HI-.js.map} +1 -1
- package/lib/esm/{index-bVubJ6Rv.js → index-3HeWs5rX.js} +18 -17
- package/lib/esm/{index-bVubJ6Rv.js.map → index-3HeWs5rX.js.map} +1 -1
- package/lib/esm/{index-6P9Xk934.js → index-3bDzhU6z.js} +15 -14
- package/lib/esm/{index-6P9Xk934.js.map → index-3bDzhU6z.js.map} +1 -1
- package/lib/esm/{index-NmjiRA0M.js → index-6GrVnloh.js} +38 -37
- package/lib/{cjs/index-GEIgbcVc.js.map → esm/index-6GrVnloh.js.map} +1 -1
- package/lib/esm/index-8QJbxTYk.js +1145 -0
- package/lib/esm/index-8QJbxTYk.js.map +1 -0
- package/lib/esm/{index-218OjRxG.js → index-9w_hdnvb.js} +39 -56
- package/lib/esm/index-9w_hdnvb.js.map +1 -0
- package/lib/esm/index-A83StUe6.js +174 -0
- package/lib/esm/index-A83StUe6.js.map +1 -0
- package/lib/esm/{index-TNMG6UrN.js → index-AOoFzBaK.js} +9 -9
- package/lib/esm/index-AOoFzBaK.js.map +1 -0
- package/lib/esm/{index-L7VXk-jT.js → index-DS7Z4Ach.js} +15 -14
- package/lib/{cjs/index-fkT0ywfA.js.map → esm/index-DS7Z4Ach.js.map} +1 -1
- package/lib/esm/index-Jvxff1vU.js.map +1 -1
- package/lib/esm/{index-JkHHp3K-.js → index-LAdX6LsO.js} +11712 -352
- package/lib/esm/index-LAdX6LsO.js.map +1 -0
- package/lib/esm/{index-VyZguCIt.js → index-MB6wQe1U.js} +12 -7
- package/lib/esm/index-MB6wQe1U.js.map +1 -0
- package/lib/esm/{index-vwrMVELn.js → index-MxgqkRtj.js} +15 -14
- package/lib/{cjs/index-vlxA_KJ8.js.map → esm/index-MxgqkRtj.js.map} +1 -1
- package/lib/esm/{index-hQaRWeq1.js → index-NZ5-xr5_.js} +18 -17
- package/lib/esm/{index-hQaRWeq1.js.map → index-NZ5-xr5_.js.map} +1 -1
- package/lib/esm/{index-x-zW6gKj.js → index-OpUb5xP6.js} +2 -2
- package/lib/esm/{index-x-zW6gKj.js.map → index-OpUb5xP6.js.map} +1 -1
- package/lib/esm/{index-oMy83ynO.js → index-SDPCpsD5.js} +15 -14
- package/lib/esm/{index-oMy83ynO.js.map → index-SDPCpsD5.js.map} +1 -1
- package/lib/esm/{index-bsED907r.js → index-VP76m4nW.js} +16 -15
- package/lib/esm/{index-bsED907r.js.map → index-VP76m4nW.js.map} +1 -1
- package/lib/esm/{index-PkBZpDL4.js → index-Vl0W0S3h.js} +14 -13
- package/lib/esm/index-Vl0W0S3h.js.map +1 -0
- package/lib/esm/{index-rwcSpYkt.js → index-VoX_n1l_.js} +17 -16
- package/lib/{cjs/index-de3dfsQr.js.map → esm/index-VoX_n1l_.js.map} +1 -1
- package/lib/esm/{index-7BVeXLQZ.js → index-XH7OnwZl.js} +15 -14
- package/lib/{cjs/index-OA_u95ey.js.map → esm/index-XH7OnwZl.js.map} +1 -1
- package/lib/esm/{index-a-SAfeeT.js → index-Yuj7sNhQ.js} +18 -17
- package/lib/esm/{index-a-SAfeeT.js.map → index-Yuj7sNhQ.js.map} +1 -1
- package/lib/esm/{index-A9zdyi2L.js → index-_4fWmRbN.js} +15 -14
- package/lib/esm/{index-A9zdyi2L.js.map → index-_4fWmRbN.js.map} +1 -1
- package/lib/esm/{index-Grquo08f.js → index-bexsWrgs.js} +18 -17
- package/lib/{cjs/index-mJ47ZWO2.js.map → esm/index-bexsWrgs.js.map} +1 -1
- package/lib/esm/{index-pHsvfB_I.js → index-chrnjY1D.js} +29 -62
- package/lib/esm/index-chrnjY1D.js.map +1 -0
- package/lib/esm/{index-UBeneu17.js → index-eqd5wtjX.js} +15 -14
- package/lib/esm/{index-UBeneu17.js.map → index-eqd5wtjX.js.map} +1 -1
- package/lib/esm/{index-4QzlLVWs.js → index-g_3dzLYU.js} +15 -14
- package/lib/{cjs/index-i0_v2uVp.js.map → esm/index-g_3dzLYU.js.map} +1 -1
- package/lib/esm/{index-0khVa44f.js → index-grT-Kuf2.js} +15 -14
- package/lib/{cjs/index-LdEYPSZc.js.map → esm/index-grT-Kuf2.js.map} +1 -1
- package/lib/esm/{index-AHPvVH4H.js → index-hF04phbf.js} +20 -28
- package/lib/esm/index-hF04phbf.js.map +1 -0
- package/lib/esm/{index-q-qE7-96.js → index-i79QMXpJ.js} +55 -52
- package/lib/esm/index-i79QMXpJ.js.map +1 -0
- package/lib/esm/{index-DoEghZHy.js → index-rvOBAXap.js} +18 -17
- package/lib/{cjs/index-TEjdwq--.js.map → esm/index-rvOBAXap.js.map} +1 -1
- package/lib/esm/index-uP9BKsTM.js +446 -0
- package/lib/esm/index-uP9BKsTM.js.map +1 -0
- package/lib/esm/index-ueQQMSgm.js +1351 -0
- package/lib/esm/index-ueQQMSgm.js.map +1 -0
- package/lib/esm/{index-U71v7KdA.js → index-x8SyiPMC.js} +15 -14
- package/lib/esm/{index-U71v7KdA.js.map → index-x8SyiPMC.js.map} +1 -1
- package/lib/esm/{index-U8q-F7hU.js → index-zrQXXSXm.js} +15 -14
- package/lib/esm/{index-U8q-F7hU.js.map → index-zrQXXSXm.js.map} +1 -1
- package/lib/esm/index.js +7 -6
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/{schema-hVsy-vme.js → schema-JWJqD9qa.js} +3 -3
- package/lib/esm/{schema-hVsy-vme.js.map → schema-JWJqD9qa.js.map} +1 -1
- package/lib/esm/todoList-M-PGJKde.js +378 -0
- package/lib/esm/todoList-M-PGJKde.js.map +1 -0
- package/lib/esm/{tooltip-plugin-vZefVSGL.js → tooltip-plugin-iw2EQWIG.js} +10 -19
- package/lib/esm/tooltip-plugin-iw2EQWIG.js.map +1 -0
- package/lib/theme/_internal/classic-common.css +3 -2
- package/lib/theme/common/block-edit.css +3 -1
- package/lib/theme/common/code-mirror.css +15 -0
- package/lib/theme/common/cursor.css +1 -1
- package/lib/theme/common/image-block.css +2 -0
- package/lib/theme/common/link-tooltip.css +10 -13
- package/lib/theme/common/list-item.css +16 -1
- package/lib/theme/common/prosemirror.css +1 -1
- package/lib/theme/common/style.css +1 -0
- package/lib/theme/common/table.css +217 -0
- package/lib/theme/common/toolbar.css +11 -4
- package/lib/theme/{classic-dark → crepe-dark}/style.css +2 -2
- package/lib/theme/frame/style.css +28 -0
- package/lib/theme/frame-dark/style.css +28 -0
- package/lib/theme/nord/style.css +28 -0
- package/lib/theme/nord-dark/style.css +28 -0
- package/lib/types/core/crepe.d.ts +5 -3
- package/lib/types/core/crepe.d.ts.map +1 -1
- package/lib/types/core/slice.d.ts +2 -2
- package/lib/types/core/slice.d.ts.map +1 -1
- package/lib/types/feature/block-edit/handle/component.d.ts +3 -0
- package/lib/types/feature/block-edit/handle/component.d.ts.map +1 -1
- package/lib/types/feature/block-edit/handle/index.d.ts +5 -4
- package/lib/types/feature/block-edit/handle/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/index.d.ts +43 -2
- package/lib/types/feature/block-edit/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/component.d.ts +3 -1
- package/lib/types/feature/block-edit/menu/component.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/config.d.ts +3 -12
- package/lib/types/feature/block-edit/menu/config.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/group-builder.d.ts +29 -0
- package/lib/types/feature/block-edit/menu/group-builder.d.ts.map +1 -0
- package/lib/types/feature/block-edit/menu/index.d.ts +5 -4
- package/lib/types/feature/block-edit/menu/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/utils.d.ts +28 -0
- package/lib/types/feature/block-edit/menu/utils.d.ts.map +1 -0
- package/lib/types/feature/code-mirror/index.d.ts +9 -1
- package/lib/types/feature/code-mirror/index.d.ts.map +1 -1
- package/lib/types/feature/cursor/index.d.ts +1 -1
- package/lib/types/feature/cursor/index.d.ts.map +1 -1
- package/lib/types/feature/image-block/index.d.ts +19 -2
- package/lib/types/feature/image-block/index.d.ts.map +1 -1
- package/lib/types/feature/index.d.ts +17 -2
- package/lib/types/feature/index.d.ts.map +1 -1
- package/lib/types/feature/link-tooltip/index.d.ts +12 -2
- package/lib/types/feature/link-tooltip/index.d.ts.map +1 -1
- package/lib/types/feature/list-item/index.d.ts +8 -2
- package/lib/types/feature/list-item/index.d.ts.map +1 -1
- package/lib/types/feature/placeholder/index.d.ts +2 -2
- package/lib/types/feature/placeholder/index.d.ts.map +1 -1
- package/lib/types/feature/shared.d.ts +3 -1
- package/lib/types/feature/shared.d.ts.map +1 -1
- package/lib/types/feature/table/index.d.ts +16 -0
- package/lib/types/feature/table/index.d.ts.map +1 -0
- package/lib/types/feature/toolbar/component.d.ts +3 -1
- package/lib/types/feature/toolbar/component.d.ts.map +1 -1
- package/lib/types/feature/toolbar/index.d.ts +11 -2
- package/lib/types/feature/toolbar/index.d.ts.map +1 -1
- package/lib/types/icons/alignCenter.d.ts +2 -0
- package/lib/types/icons/alignCenter.d.ts.map +1 -0
- package/lib/types/icons/alignLeft.d.ts +2 -0
- package/lib/types/icons/alignLeft.d.ts.map +1 -0
- package/lib/types/icons/alignRight.d.ts +2 -0
- package/lib/types/icons/alignRight.d.ts.map +1 -0
- package/lib/types/icons/bold.d.ts +2 -0
- package/lib/types/icons/bold.d.ts.map +1 -0
- package/lib/types/{feature/list-item/consts.d.ts → icons/bullet.d.ts} +1 -1
- package/lib/types/icons/bullet.d.ts.map +1 -0
- package/lib/types/icons/bulletList.d.ts +2 -0
- package/lib/types/icons/bulletList.d.ts.map +1 -0
- package/lib/types/icons/caption.d.ts +2 -0
- package/lib/types/icons/caption.d.ts.map +1 -0
- package/lib/types/icons/checkBoxChecked.d.ts +2 -0
- package/lib/types/icons/checkBoxChecked.d.ts.map +1 -0
- package/lib/types/icons/checkBoxUnchecked.d.ts +2 -0
- package/lib/types/icons/checkBoxUnchecked.d.ts.map +1 -0
- package/lib/types/icons/chevronDown.d.ts +2 -0
- package/lib/types/icons/chevronDown.d.ts.map +1 -0
- package/lib/types/icons/clear.d.ts +2 -0
- package/lib/types/icons/clear.d.ts.map +1 -0
- package/lib/types/icons/code.d.ts +2 -0
- package/lib/types/icons/code.d.ts.map +1 -0
- package/lib/types/icons/confirm.d.ts +2 -0
- package/lib/types/icons/confirm.d.ts.map +1 -0
- package/lib/types/icons/divider.d.ts +2 -0
- package/lib/types/icons/divider.d.ts.map +1 -0
- package/lib/types/icons/dragHandle.d.ts +2 -0
- package/lib/types/icons/dragHandle.d.ts.map +1 -0
- package/lib/types/icons/edit.d.ts +2 -0
- package/lib/types/icons/edit.d.ts.map +1 -0
- package/lib/types/icons/h1.d.ts +2 -0
- package/lib/types/icons/h1.d.ts.map +1 -0
- package/lib/types/icons/h2.d.ts +2 -0
- package/lib/types/icons/h2.d.ts.map +1 -0
- package/lib/types/icons/h3.d.ts +2 -0
- package/lib/types/icons/h3.d.ts.map +1 -0
- package/lib/types/icons/h4.d.ts +2 -0
- package/lib/types/icons/h4.d.ts.map +1 -0
- package/lib/types/icons/h5.d.ts +2 -0
- package/lib/types/icons/h5.d.ts.map +1 -0
- package/lib/types/icons/h6.d.ts +2 -0
- package/lib/types/icons/h6.d.ts.map +1 -0
- package/lib/types/icons/image.d.ts +2 -0
- package/lib/types/icons/image.d.ts.map +1 -0
- package/lib/types/icons/index.d.ts +36 -0
- package/lib/types/icons/index.d.ts.map +1 -0
- package/lib/types/icons/italic.d.ts +2 -0
- package/lib/types/icons/italic.d.ts.map +1 -0
- package/lib/types/icons/link.d.ts +2 -0
- package/lib/types/icons/link.d.ts.map +1 -0
- package/lib/types/icons/menu.d.ts +2 -0
- package/lib/types/icons/menu.d.ts.map +1 -0
- package/lib/types/icons/orderedList.d.ts +2 -0
- package/lib/types/icons/orderedList.d.ts.map +1 -0
- package/lib/types/icons/plus.d.ts +2 -0
- package/lib/types/icons/plus.d.ts.map +1 -0
- package/lib/types/icons/quote.d.ts +2 -0
- package/lib/types/icons/quote.d.ts.map +1 -0
- package/lib/types/icons/remove.d.ts +2 -0
- package/lib/types/icons/remove.d.ts.map +1 -0
- package/lib/types/icons/search.d.ts +2 -0
- package/lib/types/icons/search.d.ts.map +1 -0
- package/lib/types/icons/strikethrough.d.ts +2 -0
- package/lib/types/icons/strikethrough.d.ts.map +1 -0
- package/lib/types/icons/table.d.ts +2 -0
- package/lib/types/icons/table.d.ts.map +1 -0
- package/lib/types/icons/text.d.ts +2 -0
- package/lib/types/icons/text.d.ts.map +1 -0
- package/lib/types/icons/todoList.d.ts +2 -0
- package/lib/types/icons/todoList.d.ts.map +1 -0
- package/lib/types/utils/index.d.ts +1 -1
- package/lib/types/utils/index.d.ts.map +1 -1
- package/package.json +9 -23
- package/src/core/crepe.ts +15 -9
- package/src/core/slice.ts +2 -2
- package/src/feature/block-edit/handle/component.ts +13 -29
- package/src/feature/block-edit/handle/index.ts +16 -17
- package/src/feature/block-edit/index.ts +50 -5
- package/src/feature/block-edit/menu/component.ts +6 -7
- package/src/feature/block-edit/menu/config.ts +203 -274
- package/src/feature/block-edit/menu/group-builder.ts +50 -0
- package/src/feature/block-edit/menu/index.ts +11 -8
- package/src/feature/block-edit/menu/utils.ts +89 -0
- package/src/feature/code-mirror/index.ts +27 -19
- package/src/feature/cursor/index.ts +3 -4
- package/src/feature/image-block/index.ts +34 -41
- package/src/feature/index.ts +23 -3
- package/src/feature/link-tooltip/index.ts +23 -10
- package/src/feature/list-item/index.ts +21 -9
- package/src/feature/placeholder/index.ts +11 -6
- package/src/feature/shared.ts +4 -1
- package/src/feature/table/index.ts +54 -0
- package/src/feature/toolbar/component.ts +29 -11
- package/src/feature/toolbar/index.ts +21 -9
- package/src/icons/alignCenter.ts +7 -0
- package/src/icons/alignLeft.ts +7 -0
- package/src/icons/alignRight.ts +7 -0
- package/src/icons/bold.ts +7 -0
- package/src/{feature/list-item/consts.ts → icons/bullet.ts} +3 -3
- package/src/icons/bulletList.ts +14 -0
- package/src/icons/caption.ts +7 -0
- package/src/icons/checkBoxChecked.ts +14 -0
- package/src/icons/checkBoxUnchecked.ts +14 -0
- package/src/icons/chevronDown.ts +7 -0
- package/src/icons/clear.ts +14 -0
- package/src/icons/code.ts +14 -0
- package/src/icons/confirm.ts +14 -0
- package/src/icons/divider.ts +14 -0
- package/src/icons/dragHandle.ts +7 -0
- package/src/icons/edit.ts +14 -0
- package/src/icons/h1.ts +14 -0
- package/src/icons/h2.ts +14 -0
- package/src/icons/h3.ts +14 -0
- package/src/icons/h4.ts +14 -0
- package/src/icons/h5.ts +14 -0
- package/src/icons/h6.ts +14 -0
- package/src/icons/image.ts +14 -0
- package/src/icons/index.ts +35 -0
- package/src/icons/italic.ts +7 -0
- package/src/icons/link.ts +7 -0
- package/src/icons/menu.ts +14 -0
- package/src/icons/orderedList.ts +14 -0
- package/src/icons/plus.ts +14 -0
- package/src/icons/quote.ts +14 -0
- package/src/icons/remove.ts +7 -0
- package/src/icons/search.ts +7 -0
- package/src/icons/strikethrough.ts +7 -0
- package/src/icons/table.ts +14 -0
- package/src/icons/text.ts +14 -0
- package/src/icons/todoList.ts +7 -0
- package/src/theme/_internal/classic-common.css +3 -2
- package/src/theme/common/block-edit.css +3 -1
- package/src/theme/common/code-mirror.css +13 -0
- package/src/theme/common/cursor.css +1 -1
- package/src/theme/common/image-block.css +2 -0
- package/src/theme/common/link-tooltip.css +11 -14
- package/src/theme/common/list-item.css +9 -0
- package/src/theme/common/prosemirror.css +1 -1
- package/src/theme/common/style.css +1 -0
- package/src/theme/common/table.css +204 -0
- package/src/theme/common/toolbar.css +14 -4
- package/src/theme/{classic-dark → crepe-dark}/style.css +2 -2
- package/src/theme/frame/style.css +28 -0
- package/src/theme/frame-dark/style.css +28 -0
- package/src/theme/nord/style.css +28 -0
- package/src/theme/nord-dark/style.css +28 -0
- package/src/utils/index.ts +1 -1
- package/lib/cjs/clsx-7JLENl8W.js +0 -62
- package/lib/cjs/clsx-7JLENl8W.js.map +0 -1
- package/lib/cjs/composed-offset-position.browser.min-FwypoGc1.js.map +0 -1
- package/lib/cjs/helper-OEW-2Vxr.js +0 -9
- package/lib/cjs/helper-OEW-2Vxr.js.map +0 -1
- package/lib/cjs/index-2oxl5Zo4.js.map +0 -1
- package/lib/cjs/index-GKolgvC5.js.map +0 -1
- package/lib/cjs/index-JAqL0ybh.js.map +0 -1
- package/lib/cjs/index-Ne_pk53w.js +0 -178
- package/lib/cjs/index-Ne_pk53w.js.map +0 -1
- package/lib/cjs/index-O3vRXWIP.js.map +0 -1
- package/lib/cjs/index-OIQn1x0L.js.map +0 -1
- package/lib/cjs/index-kNI3S3lF.js.map +0 -1
- package/lib/cjs/index-kvO8ReCY.js +0 -1960
- package/lib/cjs/index-kvO8ReCY.js.map +0 -1
- package/lib/cjs/index-llNS_EuP.js.map +0 -1
- package/lib/cjs/index-xqKfEyRA.js.map +0 -1
- package/lib/cjs/meta-q8q9fHyr.js +0 -14
- package/lib/cjs/meta-q8q9fHyr.js.map +0 -1
- package/lib/cjs/tooltip-plugin-Mk9fRTxI.js.map +0 -1
- package/lib/esm/clsx-R7WFaNKL.js +0 -52
- package/lib/esm/clsx-R7WFaNKL.js.map +0 -1
- package/lib/esm/composed-offset-position.browser.min-Tnm31e-m.js.map +0 -1
- package/lib/esm/helper-iYEjPbOY.js +0 -7
- package/lib/esm/helper-iYEjPbOY.js.map +0 -1
- package/lib/esm/index-218OjRxG.js.map +0 -1
- package/lib/esm/index-AHPvVH4H.js.map +0 -1
- package/lib/esm/index-DoEghZHy.js.map +0 -1
- package/lib/esm/index-JkHHp3K-.js.map +0 -1
- package/lib/esm/index-PkBZpDL4.js.map +0 -1
- package/lib/esm/index-TNMG6UrN.js.map +0 -1
- package/lib/esm/index-VyZguCIt.js.map +0 -1
- package/lib/esm/index-h1arGiXv.js +0 -1958
- package/lib/esm/index-h1arGiXv.js.map +0 -1
- package/lib/esm/index-pHsvfB_I.js.map +0 -1
- package/lib/esm/index-q-qE7-96.js.map +0 -1
- package/lib/esm/index-u8tWJbca.js +0 -176
- package/lib/esm/index-u8tWJbca.js.map +0 -1
- package/lib/esm/meta-3ZYGAGrY.js +0 -12
- package/lib/esm/meta-3ZYGAGrY.js.map +0 -1
- package/lib/esm/tooltip-plugin-vZefVSGL.js.map +0 -1
- package/lib/types/feature/block-edit/menu/icons.d.ts +0 -14
- package/lib/types/feature/block-edit/menu/icons.d.ts.map +0 -1
- package/lib/types/feature/link-tooltip/consts.d.ts +0 -5
- package/lib/types/feature/link-tooltip/consts.d.ts.map +0 -1
- package/lib/types/feature/list-item/consts.d.ts.map +0 -1
- package/lib/types/feature/toolbar/consts.d.ts +0 -5
- package/lib/types/feature/toolbar/consts.d.ts.map +0 -1
- package/src/feature/block-edit/menu/icons.ts +0 -170
- package/src/feature/link-tooltip/consts.ts +0 -46
- package/src/feature/toolbar/consts.ts +0 -25
- /package/lib/theme/{classic → crepe}/style.css +0 -0
- /package/src/theme/{classic → crepe}/style.css +0 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { html } from 'atomico'
|
|
2
|
+
import type { Ctx } from '@milkdown/kit/ctx'
|
|
3
|
+
import type { Command, Transaction } from '@milkdown/kit/prose/state'
|
|
4
|
+
import type { Attrs, NodeType } from '@milkdown/kit/prose/model'
|
|
5
|
+
import { findWrapping } from '@milkdown/kit/prose/transform'
|
|
6
|
+
|
|
7
|
+
export interface MenuItem {
|
|
8
|
+
index: number
|
|
9
|
+
key: string
|
|
10
|
+
label: string
|
|
11
|
+
icon: ReturnType<typeof html>
|
|
12
|
+
onRun: (ctx: Ctx) => void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type WithRange<T, HasIndex extends true | false = true> = HasIndex extends true ? T & { range: [start: number, end: number] } : T
|
|
16
|
+
|
|
17
|
+
export type MenuItemGroup<HasIndex extends true | false = true> = WithRange<{
|
|
18
|
+
key: string
|
|
19
|
+
label: string
|
|
20
|
+
items: HasIndex extends true ? MenuItem[] : Omit<MenuItem, 'index'>[]
|
|
21
|
+
}, HasIndex>
|
|
22
|
+
|
|
23
|
+
export function clearRange(tr: Transaction) {
|
|
24
|
+
const { $from, $to } = tr.selection
|
|
25
|
+
const { pos: from } = $from
|
|
26
|
+
const { pos: to } = $to
|
|
27
|
+
tr = tr.deleteRange(from - $from.node().content.size, to)
|
|
28
|
+
return tr
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function setBlockType(tr: Transaction, nodeType: NodeType, attrs: Attrs | null = null) {
|
|
32
|
+
const { from, to } = tr.selection
|
|
33
|
+
return tr.setBlockType(from, to, nodeType, attrs)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function wrapInBlockType(tr: Transaction, nodeType: NodeType, attrs: Attrs | null = null) {
|
|
37
|
+
const { $from, $to } = tr.selection
|
|
38
|
+
|
|
39
|
+
const range = $from.blockRange($to)
|
|
40
|
+
const wrapping = range && findWrapping(range, nodeType, attrs)
|
|
41
|
+
if (!wrapping)
|
|
42
|
+
return null
|
|
43
|
+
|
|
44
|
+
return tr.wrap(range, wrapping)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function addBlockType(tr: Transaction, nodeType: NodeType, attrs: Attrs | null = null) {
|
|
48
|
+
const node = nodeType.createAndFill(attrs)
|
|
49
|
+
if (!node)
|
|
50
|
+
return null
|
|
51
|
+
|
|
52
|
+
return tr.replaceSelectionWith(node)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function clearContentAndSetBlockType(nodeType: NodeType, attrs: Attrs | null = null): Command {
|
|
56
|
+
return (state, dispatch) => {
|
|
57
|
+
if (dispatch) {
|
|
58
|
+
const tr = setBlockType(clearRange(state.tr), nodeType, attrs)
|
|
59
|
+
dispatch(tr.scrollIntoView())
|
|
60
|
+
}
|
|
61
|
+
return true
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function clearContentAndWrapInBlockType(nodeType: NodeType, attrs: Attrs | null = null): Command {
|
|
66
|
+
return (state, dispatch) => {
|
|
67
|
+
const tr = wrapInBlockType(clearRange(state.tr), nodeType, attrs)
|
|
68
|
+
if (!tr)
|
|
69
|
+
return false
|
|
70
|
+
|
|
71
|
+
if (dispatch)
|
|
72
|
+
dispatch(tr.scrollIntoView())
|
|
73
|
+
|
|
74
|
+
return true
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function clearContentAndAddBlockType(nodeType: NodeType, attrs: Attrs | null = null): Command {
|
|
79
|
+
return (state, dispatch) => {
|
|
80
|
+
const tr = addBlockType(clearRange(state.tr), nodeType, attrs)
|
|
81
|
+
if (!tr)
|
|
82
|
+
return false
|
|
83
|
+
|
|
84
|
+
if (dispatch)
|
|
85
|
+
dispatch(tr.scrollIntoView())
|
|
86
|
+
|
|
87
|
+
return true
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
import { codeBlockComponent, codeBlockConfig } from '@milkdown/
|
|
1
|
+
import { codeBlockComponent, codeBlockConfig } from '@milkdown/kit/component/code-block'
|
|
2
2
|
import type { LanguageDescription } from '@codemirror/language'
|
|
3
3
|
import type { Extension } from '@codemirror/state'
|
|
4
4
|
import { basicSetup } from 'codemirror'
|
|
5
5
|
import { keymap } from '@codemirror/view'
|
|
6
6
|
import { defaultKeymap, indentWithTab } from '@codemirror/commands'
|
|
7
|
-
import { html } from 'atomico'
|
|
8
|
-
import type { DefineFeature } from '../shared'
|
|
9
|
-
|
|
10
|
-
const clearIcon = html`
|
|
11
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
12
|
-
<g clip-path="url(#clip0_1098_15553)">
|
|
13
|
-
<path d="M18.3007 5.70973C17.9107 5.31973 17.2807 5.31973 16.8907 5.70973L12.0007 10.5897L7.1107 5.69973C6.7207 5.30973 6.0907 5.30973 5.7007 5.69973C5.3107 6.08973 5.3107 6.71973 5.7007 7.10973L10.5907 11.9997L5.7007 16.8897C5.3107 17.2797 5.3107 17.9097 5.7007 18.2997C6.0907 18.6897 6.7207 18.6897 7.1107 18.2997L12.0007 13.4097L16.8907 18.2997C17.2807 18.6897 17.9107 18.6897 18.3007 18.2997C18.6907 17.9097 18.6907 17.2797 18.3007 16.8897L13.4107 11.9997L18.3007 7.10973C18.6807 6.72973 18.6807 6.08973 18.3007 5.70973Z" fill="#817567"/>
|
|
14
|
-
</g>
|
|
15
|
-
<defs>
|
|
16
|
-
<clipPath id="clip0_1098_15553">
|
|
17
|
-
<rect width="24" height="24" fill="white"/>
|
|
18
|
-
</clipPath>
|
|
19
|
-
</defs>
|
|
20
|
-
</svg>
|
|
21
|
-
`
|
|
7
|
+
import type { html } from 'atomico'
|
|
8
|
+
import type { DefineFeature, Icon } from '../shared'
|
|
9
|
+
import { chevronDownIcon, clearIcon, searchIcon } from '../../icons'
|
|
22
10
|
|
|
23
11
|
interface CodeMirrorConfig {
|
|
12
|
+
extensions: Extension[]
|
|
24
13
|
languages: LanguageDescription[]
|
|
25
14
|
theme: Extension
|
|
15
|
+
|
|
16
|
+
expandIcon: Icon
|
|
17
|
+
searchIcon: Icon
|
|
18
|
+
clearSearchIcon: Icon
|
|
19
|
+
|
|
20
|
+
searchPlaceholder: string
|
|
21
|
+
noResultText: string
|
|
22
|
+
|
|
23
|
+
renderLanguage: (language: string, selected: boolean) => ReturnType<typeof html> | string | HTMLElement
|
|
26
24
|
}
|
|
27
25
|
export type CodeMirrorFeatureConfig = Partial<CodeMirrorConfig>
|
|
28
26
|
|
|
@@ -42,10 +40,20 @@ export const defineFeature: DefineFeature<CodeMirrorFeatureConfig> = (editor, co
|
|
|
42
40
|
theme = nord
|
|
43
41
|
}
|
|
44
42
|
ctx.update(codeBlockConfig.key, defaultConfig => ({
|
|
45
|
-
|
|
43
|
+
extensions: [
|
|
44
|
+
keymap.of(defaultKeymap.concat(indentWithTab)),
|
|
45
|
+
basicSetup,
|
|
46
|
+
theme,
|
|
47
|
+
...config?.extensions ?? [],
|
|
48
|
+
],
|
|
46
49
|
languages,
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
|
|
51
|
+
expandIcon: config.expandIcon || (() => chevronDownIcon),
|
|
52
|
+
searchIcon: config.searchIcon || (() => searchIcon),
|
|
53
|
+
clearSearchIcon: config.clearSearchIcon || (() => clearIcon),
|
|
54
|
+
searchPlaceholder: config.searchPlaceholder || 'Search language',
|
|
55
|
+
noResultText: config.noResultText || 'No result',
|
|
56
|
+
renderLanguage: config.renderLanguage || defaultConfig.renderLanguage,
|
|
49
57
|
}))
|
|
50
58
|
})
|
|
51
59
|
.use(codeBlockComponent)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cursor, dropCursorConfig } from '@milkdown/plugin
|
|
1
|
+
import { cursor, dropCursorConfig } from '@milkdown/kit/plugin/cursor'
|
|
2
2
|
|
|
3
3
|
import type { DefineFeature } from '../shared'
|
|
4
4
|
|
|
@@ -6,13 +6,12 @@ interface CursorConfig {
|
|
|
6
6
|
color: string | false
|
|
7
7
|
width: number
|
|
8
8
|
}
|
|
9
|
-
export type CursorFeatureConfig = CursorConfig
|
|
9
|
+
export type CursorFeatureConfig = Partial<CursorConfig>
|
|
10
10
|
|
|
11
11
|
export const defineFeature: DefineFeature<CursorFeatureConfig> = (editor, config) => {
|
|
12
12
|
editor
|
|
13
13
|
.config((ctx) => {
|
|
14
|
-
ctx.update(dropCursorConfig.key,
|
|
15
|
-
...value,
|
|
14
|
+
ctx.update(dropCursorConfig.key, () => ({
|
|
16
15
|
class: 'crepe-drop-cursor',
|
|
17
16
|
width: config?.width ?? 4,
|
|
18
17
|
color: config?.color ?? false,
|
|
@@ -1,53 +1,46 @@
|
|
|
1
|
-
import { imageBlockComponent, imageBlockConfig } from '@milkdown/
|
|
2
|
-
import { imageInlineComponent, inlineImageConfig } from '@milkdown/
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { imageBlockComponent, imageBlockConfig } from '@milkdown/kit/component/image-block'
|
|
2
|
+
import { imageInlineComponent, inlineImageConfig } from '@milkdown/kit/component/image-inline'
|
|
3
|
+
import type { DefineFeature, Icon } from '../shared'
|
|
4
|
+
import { captionIcon, confirmIcon, imageIcon } from '../../icons'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<g clip-path="url(#clip0_1013_1596)">
|
|
9
|
-
<path d="M19 5V19H5V5H19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM14.14 11.86L11.14 15.73L9 13.14L6 17H18L14.14 11.86Z" fill="#817567"/>
|
|
10
|
-
</g>
|
|
11
|
-
<defs>
|
|
12
|
-
<clipPath id="clip0_1013_1596">
|
|
13
|
-
<rect width="24" height="24" fill="white"/>
|
|
14
|
-
</clipPath>
|
|
15
|
-
</defs>
|
|
16
|
-
</svg>
|
|
17
|
-
`
|
|
6
|
+
interface ImageBlockConfig {
|
|
7
|
+
onUpload: (file: File) => Promise<string>
|
|
18
8
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<defs>
|
|
25
|
-
<clipPath id="clip0_1013_1606">
|
|
26
|
-
<rect width="24" height="24" fill="white"/>
|
|
27
|
-
</clipPath>
|
|
28
|
-
</defs>
|
|
29
|
-
</svg>
|
|
30
|
-
`
|
|
9
|
+
inlineImageIcon: Icon
|
|
10
|
+
inlineConfirmButton: Icon
|
|
11
|
+
inlineUploadButton: Icon
|
|
12
|
+
inlineUploadPlaceholderText: string
|
|
13
|
+
inlineOnUpload: (file: File) => Promise<string>
|
|
31
14
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
15
|
+
blockImageIcon: Icon
|
|
16
|
+
blockConfirmButton: Icon
|
|
17
|
+
blockCaptionIcon: Icon
|
|
18
|
+
blockUploadButton: Icon
|
|
19
|
+
blockCaptionPlaceholderText: string
|
|
20
|
+
blockUploadPlaceholderText: string
|
|
21
|
+
blockOnUpload: (file: File) => Promise<string>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type ImageBlockFeatureConfig = Partial<ImageBlockConfig>
|
|
35
25
|
|
|
36
|
-
export const defineFeature: DefineFeature = (editor) => {
|
|
26
|
+
export const defineFeature: DefineFeature<ImageBlockFeatureConfig> = (editor, config) => {
|
|
37
27
|
editor
|
|
38
28
|
.config((ctx) => {
|
|
39
29
|
ctx.update(inlineImageConfig.key, value => ({
|
|
40
|
-
|
|
41
|
-
imageIcon: () => imageIcon,
|
|
42
|
-
confirmButton: () => confirmIcon,
|
|
43
|
-
uploadPlaceholderText: 'or paste link',
|
|
30
|
+
uploadButton: config?.inlineUploadButton ?? (() => 'Upload'),
|
|
31
|
+
imageIcon: config?.inlineImageIcon ?? (() => imageIcon),
|
|
32
|
+
confirmButton: config?.inlineConfirmButton ?? (() => confirmIcon),
|
|
33
|
+
uploadPlaceholderText: config?.inlineUploadPlaceholderText ?? 'or paste link',
|
|
34
|
+
onUpload: config?.inlineOnUpload ?? config?.onUpload ?? value.onUpload,
|
|
44
35
|
}))
|
|
45
36
|
ctx.update(imageBlockConfig.key, value => ({
|
|
46
|
-
|
|
47
|
-
imageIcon: () => imageIcon,
|
|
48
|
-
captionIcon: () => captionIcon,
|
|
49
|
-
confirmButton: () =>
|
|
50
|
-
captionPlaceholderText: 'Write Image Caption',
|
|
37
|
+
uploadButton: config?.blockUploadButton ?? (() => 'Upload file'),
|
|
38
|
+
imageIcon: config?.blockImageIcon ?? (() => imageIcon),
|
|
39
|
+
captionIcon: config?.blockCaptionIcon ?? (() => captionIcon),
|
|
40
|
+
confirmButton: config?.blockConfirmButton ?? (() => 'Confirm'),
|
|
41
|
+
captionPlaceholderText: config?.blockCaptionPlaceholderText ?? 'Write Image Caption',
|
|
42
|
+
uploadPlaceholderText: config?.blockUploadPlaceholderText ?? 'or paste link',
|
|
43
|
+
onUpload: config?.blockOnUpload ?? config?.onUpload ?? value.onUpload,
|
|
51
44
|
}))
|
|
52
45
|
})
|
|
53
46
|
.use(imageBlockComponent)
|
package/src/feature/index.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import type { Editor } from '@milkdown/core'
|
|
1
|
+
import type { Editor } from '@milkdown/kit/core'
|
|
2
2
|
import type { PlaceHolderFeatureConfig } from './placeholder'
|
|
3
3
|
import type { CodeMirrorFeatureConfig } from './code-mirror'
|
|
4
|
+
import type { BlockEditFeatureConfig } from './block-edit'
|
|
5
|
+
import type { CursorFeatureConfig } from './cursor'
|
|
6
|
+
import type { ImageBlockFeatureConfig } from './image-block'
|
|
7
|
+
import type { LinkTooltipFeatureConfig } from './link-tooltip'
|
|
8
|
+
import type { ListItemFeatureConfig } from './list-item'
|
|
9
|
+
import type { ToolbarFeatureConfig } from './toolbar'
|
|
10
|
+
import type { TableFeatureConfig } from './table'
|
|
4
11
|
|
|
5
12
|
export enum CrepeFeature {
|
|
6
13
|
CodeMirror = 'code-mirror',
|
|
@@ -11,22 +18,31 @@ export enum CrepeFeature {
|
|
|
11
18
|
BlockEdit = 'block-edit',
|
|
12
19
|
Toolbar = 'toolbar',
|
|
13
20
|
Placeholder = 'placeholder',
|
|
21
|
+
Table = 'table',
|
|
14
22
|
}
|
|
15
23
|
|
|
16
24
|
export interface CrepeFeatureConfig {
|
|
25
|
+
[CrepeFeature.Cursor]?: CursorFeatureConfig
|
|
26
|
+
[CrepeFeature.ListItem]?: ListItemFeatureConfig
|
|
27
|
+
[CrepeFeature.LinkTooltip]?: LinkTooltipFeatureConfig
|
|
28
|
+
[CrepeFeature.ImageBlock]?: ImageBlockFeatureConfig
|
|
29
|
+
[CrepeFeature.BlockEdit]?: BlockEditFeatureConfig
|
|
17
30
|
[CrepeFeature.Placeholder]?: PlaceHolderFeatureConfig
|
|
31
|
+
[CrepeFeature.Toolbar]?: ToolbarFeatureConfig
|
|
18
32
|
[CrepeFeature.CodeMirror]?: CodeMirrorFeatureConfig
|
|
33
|
+
[CrepeFeature.Table]?: TableFeatureConfig
|
|
19
34
|
}
|
|
20
35
|
|
|
21
36
|
export const defaultFeatures: Record<CrepeFeature, boolean> = {
|
|
37
|
+
[CrepeFeature.Cursor]: true,
|
|
22
38
|
[CrepeFeature.ListItem]: true,
|
|
23
39
|
[CrepeFeature.LinkTooltip]: true,
|
|
24
40
|
[CrepeFeature.ImageBlock]: true,
|
|
25
|
-
[CrepeFeature.Cursor]: true,
|
|
26
41
|
[CrepeFeature.BlockEdit]: true,
|
|
27
42
|
[CrepeFeature.Placeholder]: true,
|
|
28
43
|
[CrepeFeature.Toolbar]: true,
|
|
29
|
-
[CrepeFeature.CodeMirror]:
|
|
44
|
+
[CrepeFeature.CodeMirror]: true,
|
|
45
|
+
[CrepeFeature.Table]: true,
|
|
30
46
|
}
|
|
31
47
|
|
|
32
48
|
export async function loadFeature(feature: CrepeFeature, editor: Editor, config?: never) {
|
|
@@ -63,5 +79,9 @@ export async function loadFeature(feature: CrepeFeature, editor: Editor, config?
|
|
|
63
79
|
const { defineFeature } = await import('./toolbar')
|
|
64
80
|
return defineFeature(editor, config)
|
|
65
81
|
}
|
|
82
|
+
case CrepeFeature.Table: {
|
|
83
|
+
const { defineFeature } = await import('./table')
|
|
84
|
+
return defineFeature(editor, config)
|
|
85
|
+
}
|
|
66
86
|
}
|
|
67
87
|
}
|
|
@@ -1,17 +1,30 @@
|
|
|
1
|
-
import { configureLinkTooltip, linkTooltipConfig, linkTooltipPlugin } from '@milkdown/
|
|
2
|
-
import type { DefineFeature } from '../shared'
|
|
3
|
-
import { confirmIcon,
|
|
1
|
+
import { configureLinkTooltip, linkTooltipConfig, linkTooltipPlugin } from '@milkdown/kit/component/link-tooltip'
|
|
2
|
+
import type { DefineFeature, Icon } from '../shared'
|
|
3
|
+
import { confirmIcon, editIcon, linkIcon, removeIcon } from '../../icons'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface LinkTooltipConfig {
|
|
6
|
+
linkIcon: Icon
|
|
7
|
+
editButton: Icon
|
|
8
|
+
removeButton: Icon
|
|
9
|
+
confirmButton: Icon
|
|
10
|
+
inputPlaceholder: string
|
|
11
|
+
onCopyLink: (link: string) => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type LinkTooltipFeatureConfig = Partial<LinkTooltipConfig>
|
|
15
|
+
|
|
16
|
+
export const defineFeature: DefineFeature<LinkTooltipFeatureConfig> = (editor, config) => {
|
|
6
17
|
editor
|
|
7
18
|
.config(configureLinkTooltip)
|
|
8
19
|
.config((ctx) => {
|
|
9
|
-
ctx.update(linkTooltipConfig.key,
|
|
10
|
-
...
|
|
11
|
-
linkIcon: () => linkIcon,
|
|
12
|
-
editButton: () => editIcon,
|
|
13
|
-
removeButton: () =>
|
|
14
|
-
confirmButton: () => confirmIcon,
|
|
20
|
+
ctx.update(linkTooltipConfig.key, prev => ({
|
|
21
|
+
...prev,
|
|
22
|
+
linkIcon: config?.linkIcon ?? (() => linkIcon),
|
|
23
|
+
editButton: config?.editButton ?? (() => editIcon),
|
|
24
|
+
removeButton: config?.removeButton ?? (() => removeIcon),
|
|
25
|
+
confirmButton: config?.confirmButton ?? (() => confirmIcon),
|
|
26
|
+
inputPlaceholder: config?.inputPlaceholder ?? 'Paste link...',
|
|
27
|
+
onCopyLink: config?.onCopyLink ?? (() => {}),
|
|
15
28
|
}))
|
|
16
29
|
})
|
|
17
30
|
.use(linkTooltipPlugin)
|
|
@@ -1,26 +1,38 @@
|
|
|
1
|
-
import type { Ctx } from '@milkdown/ctx'
|
|
2
|
-
import { listItemBlockComponent, listItemBlockConfig } from '@milkdown/
|
|
1
|
+
import type { Ctx } from '@milkdown/kit/ctx'
|
|
2
|
+
import { listItemBlockComponent, listItemBlockConfig } from '@milkdown/kit/component/list-item-block'
|
|
3
3
|
import { html } from 'atomico'
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
4
|
+
import clsx from 'clsx'
|
|
5
|
+
import type { DefineFeature, Icon } from '../shared'
|
|
6
|
+
import { bulletIcon, checkBoxCheckedIcon, checkBoxUncheckedIcon } from '../../icons'
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
export interface ListItemConfig {
|
|
9
|
+
bulletIcon: Icon
|
|
10
|
+
checkBoxCheckedIcon: Icon
|
|
11
|
+
checkBoxUncheckedIcon: Icon
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type ListItemFeatureConfig = Partial<ListItemConfig>
|
|
15
|
+
|
|
16
|
+
function configureListItem(ctx: Ctx, config?: ListItemFeatureConfig) {
|
|
8
17
|
ctx.set(listItemBlockConfig.key, {
|
|
9
18
|
renderLabel: ({ label, listType, checked, readonly }) => {
|
|
10
19
|
if (checked == null) {
|
|
11
20
|
if (listType === 'bullet')
|
|
12
|
-
return html`<span class='label'>${bulletIcon}</span>`
|
|
21
|
+
return html`<span class='label'>${config?.bulletIcon?.() ?? bulletIcon}</span>`
|
|
13
22
|
|
|
14
23
|
return html`<span class='label'>${label}</span>`
|
|
15
24
|
}
|
|
16
25
|
|
|
17
|
-
|
|
26
|
+
if (checked)
|
|
27
|
+
return html`<span class=${clsx('label checkbox', readonly && 'readonly')}>${config?.checkBoxCheckedIcon?.() ?? checkBoxCheckedIcon}</span>`
|
|
28
|
+
|
|
29
|
+
return html`<span class=${clsx('label checkbox', readonly && 'readonly')}>${config?.checkBoxUncheckedIcon?.() ?? checkBoxUncheckedIcon}</span>`
|
|
18
30
|
},
|
|
19
31
|
})
|
|
20
32
|
}
|
|
21
33
|
|
|
22
|
-
export const defineFeature: DefineFeature = (editor) => {
|
|
34
|
+
export const defineFeature: DefineFeature<ListItemFeatureConfig> = (editor, config) => {
|
|
23
35
|
editor
|
|
24
|
-
.config(configureListItem)
|
|
36
|
+
.config(ctx => configureListItem(ctx, config))
|
|
25
37
|
.use(listItemBlockComponent)
|
|
26
38
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { $ctx, $prose } from '@milkdown/utils'
|
|
2
|
-
import type { EditorState } from '@milkdown/prose/state'
|
|
3
|
-
import { Plugin, PluginKey } from '@milkdown/prose/state'
|
|
4
|
-
import type { Node } from '@milkdown/prose/model'
|
|
5
|
-
import { Decoration, DecorationSet } from '@milkdown/prose/view'
|
|
1
|
+
import { $ctx, $prose } from '@milkdown/kit/utils'
|
|
2
|
+
import type { EditorState } from '@milkdown/kit/prose/state'
|
|
3
|
+
import { Plugin, PluginKey } from '@milkdown/kit/prose/state'
|
|
4
|
+
import type { Node } from '@milkdown/kit/prose/model'
|
|
5
|
+
import { Decoration, DecorationSet } from '@milkdown/kit/prose/view'
|
|
6
|
+
import { findParent } from '@milkdown/kit/prose'
|
|
6
7
|
import type { DefineFeature } from '../shared'
|
|
7
8
|
import { isInCodeBlock, isInList } from '../../utils'
|
|
8
9
|
|
|
@@ -23,6 +24,10 @@ function createPlaceholderDecoration(
|
|
|
23
24
|
if (node.content.size > 0)
|
|
24
25
|
return null
|
|
25
26
|
|
|
27
|
+
const inTable = findParent(node => node.type.name === 'table')($pos)
|
|
28
|
+
if (inTable)
|
|
29
|
+
return null
|
|
30
|
+
|
|
26
31
|
const before = $pos.before()
|
|
27
32
|
|
|
28
33
|
return Decoration.node(before, before + node.nodeSize, {
|
|
@@ -55,7 +60,7 @@ export const placeholderPlugin = $prose((ctx) => {
|
|
|
55
60
|
if (isInCodeBlock(state.selection) || isInList(state.selection))
|
|
56
61
|
return null
|
|
57
62
|
|
|
58
|
-
const placeholderText = config.text
|
|
63
|
+
const placeholderText = config.text ?? 'Please enter...'
|
|
59
64
|
const deco = createPlaceholderDecoration(state, placeholderText)
|
|
60
65
|
if (!deco)
|
|
61
66
|
return null
|
package/src/feature/shared.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import type { Editor } from '@milkdown/core'
|
|
1
|
+
import type { Editor } from '@milkdown/kit/core'
|
|
2
|
+
import type { html } from 'atomico'
|
|
2
3
|
|
|
3
4
|
export type DefineFeature<Config = unknown> = (editor: Editor, config?: Config) => void | Promise<void>
|
|
5
|
+
|
|
6
|
+
export type Icon = () => HTMLElement | ReturnType<typeof html> | string | null
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { tableBlock, tableBlockConfig } from '@milkdown/kit/component/table-block'
|
|
2
|
+
import type { DefineFeature, Icon } from '../shared'
|
|
3
|
+
import {
|
|
4
|
+
alignCenterIcon,
|
|
5
|
+
alignLeftIcon,
|
|
6
|
+
alignRightIcon,
|
|
7
|
+
dragHandleIcon,
|
|
8
|
+
plusIcon,
|
|
9
|
+
removeIcon,
|
|
10
|
+
} from '../../icons'
|
|
11
|
+
|
|
12
|
+
interface TableConfig {
|
|
13
|
+
addRowIcon: Icon
|
|
14
|
+
addColIcon: Icon
|
|
15
|
+
deleteRowIcon: Icon
|
|
16
|
+
deleteColIcon: Icon
|
|
17
|
+
alignLeftIcon: Icon
|
|
18
|
+
alignCenterIcon: Icon
|
|
19
|
+
alignRightIcon: Icon
|
|
20
|
+
colDragHandleIcon: Icon
|
|
21
|
+
rowDragHandleIcon: Icon
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type TableFeatureConfig = Partial<TableConfig>
|
|
25
|
+
|
|
26
|
+
export const defineFeature: DefineFeature<TableFeatureConfig> = (editor, config) => {
|
|
27
|
+
editor.config((ctx) => {
|
|
28
|
+
ctx.update(tableBlockConfig.key, defaultConfig => ({
|
|
29
|
+
...defaultConfig,
|
|
30
|
+
renderButton: (renderType) => {
|
|
31
|
+
switch (renderType) {
|
|
32
|
+
case 'add_row':
|
|
33
|
+
return config?.addRowIcon?.() ?? plusIcon
|
|
34
|
+
case 'add_col':
|
|
35
|
+
return config?.addColIcon?.() ?? plusIcon
|
|
36
|
+
case 'delete_row':
|
|
37
|
+
return config?.deleteRowIcon?.() ?? removeIcon
|
|
38
|
+
case 'delete_col':
|
|
39
|
+
return config?.deleteColIcon?.() ?? removeIcon
|
|
40
|
+
case 'align_col_left':
|
|
41
|
+
return config?.alignLeftIcon?.() ?? alignLeftIcon
|
|
42
|
+
case 'align_col_center':
|
|
43
|
+
return config?.alignCenterIcon?.() ?? alignCenterIcon
|
|
44
|
+
case 'align_col_right':
|
|
45
|
+
return config?.alignRightIcon?.() ?? alignRightIcon
|
|
46
|
+
case 'col_drag_handle':
|
|
47
|
+
return config?.colDragHandleIcon?.() ?? dragHandleIcon
|
|
48
|
+
case 'row_drag_handle':
|
|
49
|
+
return config?.rowDragHandleIcon?.() ?? dragHandleIcon
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
}))
|
|
53
|
+
}).use(tableBlock)
|
|
54
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Component } from 'atomico'
|
|
2
2
|
import { c, html, useEffect, useUpdate } from 'atomico'
|
|
3
|
-
import type { Ctx } from '@milkdown/ctx'
|
|
4
|
-
import { commandsCtx, editorViewCtx } from '@milkdown/core'
|
|
3
|
+
import type { Ctx } from '@milkdown/kit/ctx'
|
|
4
|
+
import { commandsCtx, editorViewCtx } from '@milkdown/kit/core'
|
|
5
5
|
import {
|
|
6
6
|
emphasisSchema,
|
|
7
7
|
inlineCodeSchema,
|
|
@@ -10,19 +10,27 @@ import {
|
|
|
10
10
|
toggleEmphasisCommand,
|
|
11
11
|
toggleInlineCodeCommand,
|
|
12
12
|
toggleStrongCommand,
|
|
13
|
-
} from '@milkdown/preset
|
|
14
|
-
import type { MarkType } from '@milkdown/prose/model'
|
|
13
|
+
} from '@milkdown/kit/preset/commonmark'
|
|
14
|
+
import type { MarkType } from '@milkdown/kit/prose/model'
|
|
15
15
|
import clsx from 'clsx'
|
|
16
|
-
import { linkTooltipAPI } from '@milkdown/
|
|
17
|
-
import {
|
|
16
|
+
import { linkTooltipAPI } from '@milkdown/kit/component/link-tooltip'
|
|
17
|
+
import { strikethroughSchema, toggleStrikethroughCommand } from '@milkdown/kit/preset/gfm'
|
|
18
|
+
import { boldIcon, codeIcon, italicIcon, linkIcon, strikethroughIcon } from '../../icons'
|
|
19
|
+
import type { ToolbarFeatureConfig } from './index'
|
|
18
20
|
|
|
19
21
|
export interface ToolbarProps {
|
|
20
22
|
ctx: Ctx
|
|
21
23
|
hide: () => void
|
|
22
24
|
show: boolean
|
|
25
|
+
config?: ToolbarFeatureConfig
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
export const toolbarComponent: Component<ToolbarProps> = ({
|
|
28
|
+
export const toolbarComponent: Component<ToolbarProps> = ({
|
|
29
|
+
ctx,
|
|
30
|
+
hide,
|
|
31
|
+
show,
|
|
32
|
+
config,
|
|
33
|
+
}) => {
|
|
26
34
|
const update = useUpdate()
|
|
27
35
|
useEffect(() => {
|
|
28
36
|
update()
|
|
@@ -50,7 +58,7 @@ export const toolbarComponent: Component<ToolbarProps> = ({ ctx, hide, show }) =
|
|
|
50
58
|
commands.call(toggleStrongCommand.key)
|
|
51
59
|
})}
|
|
52
60
|
>
|
|
53
|
-
${boldIcon}
|
|
61
|
+
${config?.boldIcon?.() ?? boldIcon}
|
|
54
62
|
</button>
|
|
55
63
|
<button
|
|
56
64
|
class=${clsx('toolbar-item', ctx && isActive(emphasisSchema.type(ctx)) && 'active')}
|
|
@@ -59,7 +67,16 @@ export const toolbarComponent: Component<ToolbarProps> = ({ ctx, hide, show }) =
|
|
|
59
67
|
commands.call(toggleEmphasisCommand.key)
|
|
60
68
|
})}
|
|
61
69
|
>
|
|
62
|
-
${italicIcon}
|
|
70
|
+
${config?.italicIcon?.() ?? italicIcon}
|
|
71
|
+
</button>
|
|
72
|
+
<button
|
|
73
|
+
class=${clsx('toolbar-item', ctx && isActive(strikethroughSchema.type(ctx)) && 'active')}
|
|
74
|
+
onmousedown=${onClick((ctx) => {
|
|
75
|
+
const commands = ctx.get(commandsCtx)
|
|
76
|
+
commands.call(toggleStrikethroughCommand.key)
|
|
77
|
+
})}
|
|
78
|
+
>
|
|
79
|
+
${config?.strikethroughIcon?.() ?? strikethroughIcon}
|
|
63
80
|
</button>
|
|
64
81
|
<div class="divider"></div>
|
|
65
82
|
<button
|
|
@@ -69,7 +86,7 @@ export const toolbarComponent: Component<ToolbarProps> = ({ ctx, hide, show }) =
|
|
|
69
86
|
commands.call(toggleInlineCodeCommand.key)
|
|
70
87
|
})}
|
|
71
88
|
>
|
|
72
|
-
${codeIcon}
|
|
89
|
+
${config?.codeIcon?.() ?? codeIcon}
|
|
73
90
|
</button>
|
|
74
91
|
<button
|
|
75
92
|
class=${clsx('toolbar-item', ctx && isActive(linkSchema.type(ctx)) && 'active')}
|
|
@@ -86,7 +103,7 @@ export const toolbarComponent: Component<ToolbarProps> = ({ ctx, hide, show }) =
|
|
|
86
103
|
hide?.()
|
|
87
104
|
})}
|
|
88
105
|
>
|
|
89
|
-
${linkIcon}
|
|
106
|
+
${config?.linkIcon?.() ?? linkIcon}
|
|
90
107
|
</button>
|
|
91
108
|
</host>`
|
|
92
109
|
}
|
|
@@ -95,6 +112,7 @@ toolbarComponent.props = {
|
|
|
95
112
|
ctx: Object,
|
|
96
113
|
hide: Function,
|
|
97
114
|
show: Boolean,
|
|
115
|
+
config: Object,
|
|
98
116
|
}
|
|
99
117
|
|
|
100
118
|
export const ToolbarElement = c(toolbarComponent)
|