@milkdown/crepe 7.5.0 → 7.5.2
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/index-N1cRxqdw.js +39 -0
- package/lib/cjs/index-N1cRxqdw.js.map +1 -0
- package/lib/cjs/{index-cpC-j5Nt.js → index-TGmNEvsj.js} +31 -40
- package/lib/cjs/index-TGmNEvsj.js.map +1 -0
- package/lib/cjs/index-dEVmN_aj.js +26 -0
- package/lib/cjs/index-dEVmN_aj.js.map +1 -0
- package/lib/cjs/index-fhKBUFkq.js +46 -0
- package/lib/cjs/index-fhKBUFkq.js.map +1 -0
- package/lib/cjs/index-ocxd4A-M.js +675 -0
- package/lib/cjs/index-ocxd4A-M.js.map +1 -0
- package/lib/cjs/{index-J3XY9IPt.js → index-rFFAL9YA.js} +9 -17
- package/lib/cjs/{index-J3XY9IPt.js.map → index-rFFAL9YA.js.map} +1 -1
- package/lib/cjs/index-rLAgJeYn.js +28 -0
- package/lib/cjs/index-rLAgJeYn.js.map +1 -0
- package/lib/cjs/index-tlx25I_m.js +36 -0
- package/lib/cjs/index-tlx25I_m.js.map +1 -0
- package/lib/cjs/index-uleaJDBC.js +19 -0
- package/lib/cjs/index-uleaJDBC.js.map +1 -0
- package/lib/cjs/index.js +150 -14
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/{todoList-Ze4FLMlx.js → todoList-YYRQo7wG.js} +1 -12
- package/lib/cjs/todoList-YYRQo7wG.js.map +1 -0
- package/lib/esm/index-6JoGWH2I.js +17 -0
- package/lib/esm/index-6JoGWH2I.js.map +1 -0
- package/lib/esm/{index-MB6wQe1U.js → index-CMGDOz11.js} +5 -13
- package/lib/esm/{index-MB6wQe1U.js.map → index-CMGDOz11.js.map} +1 -1
- package/lib/esm/index-HlPKwzLC.js +34 -0
- package/lib/esm/index-HlPKwzLC.js.map +1 -0
- package/lib/esm/index-_A9vu1ED.js +673 -0
- package/lib/esm/index-_A9vu1ED.js.map +1 -0
- package/lib/esm/index-amuALmzU.js +26 -0
- package/lib/esm/index-amuALmzU.js.map +1 -0
- package/lib/esm/index-fVrfHXda.js +24 -0
- package/lib/esm/index-fVrfHXda.js.map +1 -0
- package/lib/esm/index-jU_6odT9.js +44 -0
- package/lib/esm/index-jU_6odT9.js.map +1 -0
- package/lib/esm/index-ohmbt6Ys.js +37 -0
- package/lib/esm/index-ohmbt6Ys.js.map +1 -0
- package/lib/esm/{index-A83StUe6.js → index-w69wbtEZ.js} +9 -18
- package/lib/esm/{index-A83StUe6.js.map → index-w69wbtEZ.js.map} +1 -1
- package/lib/esm/index.js +152 -12
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/{todoList-M-PGJKde.js → todoList-9QsDDcmB.js} +2 -12
- package/lib/esm/todoList-9QsDDcmB.js.map +1 -0
- package/package.json +2 -4
- package/lib/cjs/_view-N32ied53.js +0 -27
- package/lib/cjs/_view-N32ied53.js.map +0 -1
- package/lib/cjs/apl-99bWvYTf.js +0 -145
- package/lib/cjs/apl-99bWvYTf.js.map +0 -1
- package/lib/cjs/asciiarmor-cf0JLIr_.js +0 -59
- package/lib/cjs/asciiarmor-cf0JLIr_.js.map +0 -1
- package/lib/cjs/asn1-H4XzAvBS.js +0 -195
- package/lib/cjs/asn1-H4XzAvBS.js.map +0 -1
- package/lib/cjs/asterisk-0FgJEfZB.js +0 -190
- package/lib/cjs/asterisk-0FgJEfZB.js.map +0 -1
- package/lib/cjs/brainfuck-JX7vRZy7.js +0 -73
- package/lib/cjs/brainfuck-JX7vRZy7.js.map +0 -1
- package/lib/cjs/clike-ueXlMQy5.js +0 -1034
- package/lib/cjs/clike-ueXlMQy5.js.map +0 -1
- package/lib/cjs/clojure-6iDAG5oi.js +0 -277
- package/lib/cjs/clojure-6iDAG5oi.js.map +0 -1
- package/lib/cjs/clsx-dASsG01A.js +0 -6
- package/lib/cjs/clsx-dASsG01A.js.map +0 -1
- package/lib/cjs/cmake-L0RIBnfc.js +0 -84
- package/lib/cjs/cmake-L0RIBnfc.js.map +0 -1
- package/lib/cjs/cobol-oxkMh1GJ.js +0 -238
- package/lib/cjs/cobol-oxkMh1GJ.js.map +0 -1
- package/lib/cjs/coffeescript--eauIeRQ.js +0 -332
- package/lib/cjs/coffeescript--eauIeRQ.js.map +0 -1
- package/lib/cjs/commonlisp-pgSu-q6f.js +0 -111
- package/lib/cjs/commonlisp-pgSu-q6f.js.map +0 -1
- package/lib/cjs/crystal-2y3I5ibZ.js +0 -422
- package/lib/cjs/crystal-2y3I5ibZ.js.map +0 -1
- package/lib/cjs/css-WH69cXzo.js +0 -855
- package/lib/cjs/css-WH69cXzo.js.map +0 -1
- package/lib/cjs/cypher-da-dqVyQ.js +0 -125
- package/lib/cjs/cypher-da-dqVyQ.js.map +0 -1
- package/lib/cjs/d-58J7EOkP.js +0 -208
- package/lib/cjs/d-58J7EOkP.js.map +0 -1
- package/lib/cjs/diff-437Hfzqm.js +0 -33
- package/lib/cjs/diff-437Hfzqm.js.map +0 -1
- package/lib/cjs/dockerfile-7i0OoaQe.js +0 -202
- package/lib/cjs/dockerfile-7i0OoaQe.js.map +0 -1
- package/lib/cjs/dtd-AKekCPPB.js +0 -124
- package/lib/cjs/dtd-AKekCPPB.js.map +0 -1
- package/lib/cjs/dylan-DLEmvz1I.js +0 -340
- package/lib/cjs/dylan-DLEmvz1I.js.map +0 -1
- package/lib/cjs/ebnf-36cJWqxB.js +0 -154
- package/lib/cjs/ebnf-36cJWqxB.js.map +0 -1
- package/lib/cjs/ecl-UWr5vJKJ.js +0 -193
- package/lib/cjs/ecl-UWr5vJKJ.js.map +0 -1
- package/lib/cjs/eiffel-Su-C9LAY.js +0 -149
- package/lib/cjs/eiffel-Su-C9LAY.js.map +0 -1
- package/lib/cjs/elm-vNNfVJj7.js +0 -233
- package/lib/cjs/elm-vNNfVJj7.js.map +0 -1
- package/lib/cjs/erlang-NM9dgYaS.js +0 -584
- package/lib/cjs/erlang-NM9dgYaS.js.map +0 -1
- package/lib/cjs/factor-RWs-4aWg.js +0 -68
- package/lib/cjs/factor-RWs-4aWg.js.map +0 -1
- package/lib/cjs/fcl-acUhGCfs.js +0 -157
- package/lib/cjs/fcl-acUhGCfs.js.map +0 -1
- package/lib/cjs/floating-ui.dom-2cjBpir5.js +0 -1134
- package/lib/cjs/floating-ui.dom-2cjBpir5.js.map +0 -1
- package/lib/cjs/forth-sDkE6z3A.js +0 -167
- package/lib/cjs/forth-sDkE6z3A.js.map +0 -1
- package/lib/cjs/fortran-gkb4yvdk.js +0 -175
- package/lib/cjs/fortran-gkb4yvdk.js.map +0 -1
- package/lib/cjs/gas-mNA0qvkv.js +0 -347
- package/lib/cjs/gas-mNA0qvkv.js.map +0 -1
- package/lib/cjs/gherkin-5uyKpXXh.js +0 -150
- package/lib/cjs/gherkin-5uyKpXXh.js.map +0 -1
- package/lib/cjs/go-5XitXoIZ.js +0 -167
- package/lib/cjs/go-5XitXoIZ.js.map +0 -1
- package/lib/cjs/groovy-mz3pWMKN.js +0 -233
- package/lib/cjs/groovy-mz3pWMKN.js.map +0 -1
- package/lib/cjs/haskell-9KaSS7kb.js +0 -242
- package/lib/cjs/haskell-9KaSS7kb.js.map +0 -1
- package/lib/cjs/haxe-L8h6Pvni.js +0 -494
- package/lib/cjs/haxe-L8h6Pvni.js.map +0 -1
- package/lib/cjs/helper-1aludV1Z.js +0 -15
- package/lib/cjs/helper-1aludV1Z.js.map +0 -1
- package/lib/cjs/http-BFQQnRR-.js +0 -92
- package/lib/cjs/http-BFQQnRR-.js.map +0 -1
- package/lib/cjs/idl-29T-AzAy.js +0 -277
- package/lib/cjs/idl-29T-AzAy.js.map +0 -1
- package/lib/cjs/index--sa4NMpW.js +0 -119
- package/lib/cjs/index--sa4NMpW.js.map +0 -1
- package/lib/cjs/index--tnUmqZ_.js +0 -108
- package/lib/cjs/index--tnUmqZ_.js.map +0 -1
- package/lib/cjs/index-1vHyMXH8.js +0 -203
- package/lib/cjs/index-1vHyMXH8.js.map +0 -1
- package/lib/cjs/index-28q261C7.js +0 -448
- package/lib/cjs/index-28q261C7.js.map +0 -1
- package/lib/cjs/index-55VIM-52.js +0 -156
- package/lib/cjs/index-55VIM-52.js.map +0 -1
- package/lib/cjs/index-92bwto5V.js +0 -405
- package/lib/cjs/index-92bwto5V.js.map +0 -1
- package/lib/cjs/index-Buu2tD9O.js +0 -534
- package/lib/cjs/index-Buu2tD9O.js.map +0 -1
- package/lib/cjs/index-E4Ist86Z.js +0 -532
- package/lib/cjs/index-E4Ist86Z.js.map +0 -1
- package/lib/cjs/index-FbNqlZU8.js +0 -263
- package/lib/cjs/index-FbNqlZU8.js.map +0 -1
- package/lib/cjs/index-HH5lPgpj.js +0 -443
- package/lib/cjs/index-HH5lPgpj.js.map +0 -1
- package/lib/cjs/index-J1-yHn7v.js +0 -128
- package/lib/cjs/index-J1-yHn7v.js.map +0 -1
- package/lib/cjs/index-Jztk6JlP.js +0 -25698
- package/lib/cjs/index-Jztk6JlP.js.map +0 -1
- package/lib/cjs/index-N6pPZY61.js +0 -191
- package/lib/cjs/index-N6pPZY61.js.map +0 -1
- package/lib/cjs/index-TUJs6KKL.js +0 -472
- package/lib/cjs/index-TUJs6KKL.js.map +0 -1
- package/lib/cjs/index-Tjg8KyK7.js +0 -398
- package/lib/cjs/index-Tjg8KyK7.js.map +0 -1
- package/lib/cjs/index-VYwHTL3F.js +0 -161
- package/lib/cjs/index-VYwHTL3F.js.map +0 -1
- package/lib/cjs/index-_GOdKqUK.js +0 -1147
- package/lib/cjs/index-_GOdKqUK.js.map +0 -1
- package/lib/cjs/index-cKQcw-eu.js +0 -386
- package/lib/cjs/index-cKQcw-eu.js.map +0 -1
- package/lib/cjs/index-c_OzudR7.js +0 -699
- package/lib/cjs/index-c_OzudR7.js.map +0 -1
- package/lib/cjs/index-cb-5m0vG.js +0 -2519
- package/lib/cjs/index-cb-5m0vG.js.map +0 -1
- package/lib/cjs/index-cpC-j5Nt.js.map +0 -1
- package/lib/cjs/index-crv_k6dv.js +0 -1353
- package/lib/cjs/index-crv_k6dv.js.map +0 -1
- package/lib/cjs/index-jlfsu92T.js +0 -362
- package/lib/cjs/index-jlfsu92T.js.map +0 -1
- package/lib/cjs/index-jn036wuh.js +0 -1045
- package/lib/cjs/index-jn036wuh.js.map +0 -1
- package/lib/cjs/index-kqz-P6o6.js +0 -55
- package/lib/cjs/index-kqz-P6o6.js.map +0 -1
- package/lib/cjs/index-lBumFRUQ.js +0 -209
- package/lib/cjs/index-lBumFRUQ.js.map +0 -1
- package/lib/cjs/index-lUNj3xuC.js +0 -81
- package/lib/cjs/index-lUNj3xuC.js.map +0 -1
- package/lib/cjs/index-mcxgNBq9.js +0 -464
- package/lib/cjs/index-mcxgNBq9.js.map +0 -1
- package/lib/cjs/index-nTfDKYYi.js +0 -1029
- package/lib/cjs/index-nTfDKYYi.js.map +0 -1
- package/lib/cjs/index-tBw4NmwY.js +0 -33852
- package/lib/cjs/index-tBw4NmwY.js.map +0 -1
- package/lib/cjs/index-vfzLCXfi.js +0 -774
- package/lib/cjs/index-vfzLCXfi.js.map +0 -1
- package/lib/cjs/index-von4W2LG.js +0 -356
- package/lib/cjs/index-von4W2LG.js.map +0 -1
- package/lib/cjs/index-zXSAHvAj.js +0 -1877
- package/lib/cjs/index-zXSAHvAj.js.map +0 -1
- package/lib/cjs/javascript-5-BTydbD.js +0 -928
- package/lib/cjs/javascript-5-BTydbD.js.map +0 -1
- package/lib/cjs/jinja2-BWMz4gPk.js +0 -174
- package/lib/cjs/jinja2-BWMz4gPk.js.map +0 -1
- package/lib/cjs/julia-dtR9J3KZ.js +0 -372
- package/lib/cjs/julia-dtR9J3KZ.js.map +0 -1
- package/lib/cjs/livescript-YxT0INe3.js +0 -262
- package/lib/cjs/livescript-YxT0INe3.js.map +0 -1
- package/lib/cjs/lua-h7_AXjy9.js +0 -140
- package/lib/cjs/lua-h7_AXjy9.js.map +0 -1
- package/lib/cjs/mathematica-Zc57fOr3.js +0 -156
- package/lib/cjs/mathematica-Zc57fOr3.js.map +0 -1
- package/lib/cjs/mbox-ltKsKgJd.js +0 -117
- package/lib/cjs/mbox-ltKsKgJd.js.map +0 -1
- package/lib/cjs/mirc-xTLeWqmy.js +0 -179
- package/lib/cjs/mirc-xTLeWqmy.js.map +0 -1
- package/lib/cjs/mllike-xukl-Kjp.js +0 -351
- package/lib/cjs/mllike-xukl-Kjp.js.map +0 -1
- package/lib/cjs/modelica-LsXtAawk.js +0 -195
- package/lib/cjs/modelica-LsXtAawk.js.map +0 -1
- package/lib/cjs/mscgen-9HooYIVW.js +0 -154
- package/lib/cjs/mscgen-9HooYIVW.js.map +0 -1
- package/lib/cjs/mumps-VXqGp84f.js +0 -132
- package/lib/cjs/mumps-VXqGp84f.js.map +0 -1
- package/lib/cjs/nginx-UrubUbn1.js +0 -166
- package/lib/cjs/nginx-UrubUbn1.js.map +0 -1
- package/lib/cjs/nsis-c2AYwqyy.js +0 -83
- package/lib/cjs/nsis-c2AYwqyy.js.map +0 -1
- package/lib/cjs/ntriples-N1nwiheD.js +0 -144
- package/lib/cjs/ntriples-N1nwiheD.js.map +0 -1
- package/lib/cjs/octave-ElonStfZ.js +0 -115
- package/lib/cjs/octave-ElonStfZ.js.map +0 -1
- package/lib/cjs/oz-7VQTnCfu.js +0 -238
- package/lib/cjs/oz-7VQTnCfu.js.map +0 -1
- package/lib/cjs/pascal-yq2Cb88Q.js +0 -127
- package/lib/cjs/pascal-yq2Cb88Q.js.map +0 -1
- package/lib/cjs/perl-hJq4byS9.js +0 -822
- package/lib/cjs/perl-hJq4byS9.js.map +0 -1
- package/lib/cjs/pig-2syuOlAa.js +0 -152
- package/lib/cjs/pig-2syuOlAa.js.map +0 -1
- package/lib/cjs/powershell-NDwxuSDg.js +0 -384
- package/lib/cjs/powershell-NDwxuSDg.js.map +0 -1
- package/lib/cjs/properties-wacODxDJ.js +0 -65
- package/lib/cjs/properties-wacODxDJ.js.map +0 -1
- package/lib/cjs/protobuf-zVHZwskk.js +0 -57
- package/lib/cjs/protobuf-zVHZwskk.js.map +0 -1
- package/lib/cjs/puppet-koQikqO-.js +0 -208
- package/lib/cjs/puppet-koQikqO-.js.map +0 -1
- package/lib/cjs/python-P3UsKHbj.js +0 -394
- package/lib/cjs/python-P3UsKHbj.js.map +0 -1
- package/lib/cjs/q-Z_d2uXoA.js +0 -126
- package/lib/cjs/q-Z_d2uXoA.js.map +0 -1
- package/lib/cjs/r-J6Jl9z1i.js +0 -177
- package/lib/cjs/r-J6Jl9z1i.js.map +0 -1
- package/lib/cjs/rpm-6C0Omumu.js +0 -93
- package/lib/cjs/rpm-6C0Omumu.js.map +0 -1
- package/lib/cjs/ruby-POVyUmsb.js +0 -290
- package/lib/cjs/ruby-POVyUmsb.js.map +0 -1
- package/lib/cjs/sas-vDtpSmFr.js +0 -271
- package/lib/cjs/sas-vDtpSmFr.js.map +0 -1
- package/lib/cjs/schema-RVrwDDcq.js +0 -74
- package/lib/cjs/schema-RVrwDDcq.js.map +0 -1
- package/lib/cjs/scheme-5AA5BH7S.js +0 -266
- package/lib/cjs/scheme-5AA5BH7S.js.map +0 -1
- package/lib/cjs/shell-_ztDMiW6.js +0 -148
- package/lib/cjs/shell-_ztDMiW6.js.map +0 -1
- package/lib/cjs/sieve-R_vzlbvH.js +0 -181
- package/lib/cjs/sieve-R_vzlbvH.js.map +0 -1
- package/lib/cjs/simple-mode-ZwmNbV0h.js +0 -138
- package/lib/cjs/simple-mode-ZwmNbV0h.js.map +0 -1
- package/lib/cjs/smalltalk-dWLp5zN8.js +0 -156
- package/lib/cjs/smalltalk-dWLp5zN8.js.map +0 -1
- package/lib/cjs/solr-wSmvjKI8.js +0 -83
- package/lib/cjs/solr-wSmvjKI8.js.map +0 -1
- package/lib/cjs/sparql-GNU_0xKB.js +0 -173
- package/lib/cjs/sparql-GNU_0xKB.js.map +0 -1
- package/lib/cjs/spreadsheet-BiqYLk6M.js +0 -101
- package/lib/cjs/spreadsheet-BiqYLk6M.js.map +0 -1
- package/lib/cjs/sql-9GpHBPsC.js +0 -497
- package/lib/cjs/sql-9GpHBPsC.js.map +0 -1
- package/lib/cjs/stex-1V41CNLk.js +0 -250
- package/lib/cjs/stex-1V41CNLk.js.map +0 -1
- package/lib/cjs/stylus-H6hn9z_G.js +0 -753
- package/lib/cjs/stylus-H6hn9z_G.js.map +0 -1
- package/lib/cjs/swift-Xv5f8zgN.js +0 -205
- package/lib/cjs/swift-Xv5f8zgN.js.map +0 -1
- package/lib/cjs/tcl-LI-LOw_t.js +0 -128
- package/lib/cjs/tcl-LI-LOw_t.js.map +0 -1
- package/lib/cjs/textile-3NvRPUgg.js +0 -444
- package/lib/cjs/textile-3NvRPUgg.js.map +0 -1
- package/lib/cjs/tiddlywiki-PkMzy8_R.js +0 -281
- package/lib/cjs/tiddlywiki-PkMzy8_R.js.map +0 -1
- package/lib/cjs/tiki-Zk_GnEC8.js +0 -292
- package/lib/cjs/tiki-Zk_GnEC8.js.map +0 -1
- package/lib/cjs/todoList-Ze4FLMlx.js.map +0 -1
- package/lib/cjs/toml-36gJ0YCq.js +0 -78
- package/lib/cjs/toml-36gJ0YCq.js.map +0 -1
- package/lib/cjs/tooltip-plugin--lhebztC.js +0 -191
- package/lib/cjs/tooltip-plugin--lhebztC.js.map +0 -1
- package/lib/cjs/troff-RLZ_o61o.js +0 -67
- package/lib/cjs/troff-RLZ_o61o.js.map +0 -1
- package/lib/cjs/ttcn-cfg-twaoJYvf.js +0 -204
- package/lib/cjs/ttcn-cfg-twaoJYvf.js.map +0 -1
- package/lib/cjs/ttcn-kGwvGb2v.js +0 -260
- package/lib/cjs/ttcn-kGwvGb2v.js.map +0 -1
- package/lib/cjs/turtle-nnevat7b.js +0 -144
- package/lib/cjs/turtle-nnevat7b.js.map +0 -1
- package/lib/cjs/vb-fO_I9s3s.js +0 -252
- package/lib/cjs/vb-fO_I9s3s.js.map +0 -1
- package/lib/cjs/vbscript-HXnn40y4.js +0 -324
- package/lib/cjs/vbscript-HXnn40y4.js.map +0 -1
- package/lib/cjs/velocity-Wn-ZfFzr.js +0 -189
- package/lib/cjs/velocity-Wn-ZfFzr.js.map +0 -1
- package/lib/cjs/verilog-y1ev34z6.js +0 -569
- package/lib/cjs/verilog-y1ev34z6.js.map +0 -1
- package/lib/cjs/vhdl-LF0oeXxc.js +0 -177
- package/lib/cjs/vhdl-LF0oeXxc.js.map +0 -1
- package/lib/cjs/webidl-6kI5KbeC.js +0 -182
- package/lib/cjs/webidl-6kI5KbeC.js.map +0 -1
- package/lib/cjs/xquery-BavrmwsO.js +0 -428
- package/lib/cjs/xquery-BavrmwsO.js.map +0 -1
- package/lib/cjs/yacas-1g_AbTrl.js +0 -185
- package/lib/cjs/yacas-1g_AbTrl.js.map +0 -1
- package/lib/cjs/z80-QYzKAAp7.js +0 -106
- package/lib/cjs/z80-QYzKAAp7.js.map +0 -1
- package/lib/esm/_view-IlZC8FA6.js +0 -25
- package/lib/esm/_view-IlZC8FA6.js.map +0 -1
- package/lib/esm/apl-eHQxyJFn.js +0 -143
- package/lib/esm/apl-eHQxyJFn.js.map +0 -1
- package/lib/esm/asciiarmor-Z-IGYCI4.js +0 -57
- package/lib/esm/asciiarmor-Z-IGYCI4.js.map +0 -1
- package/lib/esm/asn1-gF7x-q1y.js +0 -193
- package/lib/esm/asn1-gF7x-q1y.js.map +0 -1
- package/lib/esm/asterisk-swk20ftp.js +0 -188
- package/lib/esm/asterisk-swk20ftp.js.map +0 -1
- package/lib/esm/brainfuck-IFQdiQoR.js +0 -71
- package/lib/esm/brainfuck-IFQdiQoR.js.map +0 -1
- package/lib/esm/clike-q3hUF2Cx.js +0 -1019
- package/lib/esm/clike-q3hUF2Cx.js.map +0 -1
- package/lib/esm/clojure-I2Krbr2M.js +0 -275
- package/lib/esm/clojure-I2Krbr2M.js.map +0 -1
- package/lib/esm/clsx-RxCLxYpD.js +0 -4
- package/lib/esm/clsx-RxCLxYpD.js.map +0 -1
- package/lib/esm/cmake-ewwXLeuZ.js +0 -82
- package/lib/esm/cmake-ewwXLeuZ.js.map +0 -1
- package/lib/esm/cobol-fpN1nAnR.js +0 -236
- package/lib/esm/cobol-fpN1nAnR.js.map +0 -1
- package/lib/esm/coffeescript--eTFR-bH.js +0 -330
- package/lib/esm/coffeescript--eTFR-bH.js.map +0 -1
- package/lib/esm/commonlisp-XLSwVdLc.js +0 -109
- package/lib/esm/commonlisp-XLSwVdLc.js.map +0 -1
- package/lib/esm/crystal-_r3Aa1_a.js +0 -420
- package/lib/esm/crystal-_r3Aa1_a.js.map +0 -1
- package/lib/esm/css-hgwYGMKZ.js +0 -848
- package/lib/esm/css-hgwYGMKZ.js.map +0 -1
- package/lib/esm/cypher-bbJyAa-4.js +0 -123
- package/lib/esm/cypher-bbJyAa-4.js.map +0 -1
- package/lib/esm/d-5MyulviS.js +0 -206
- package/lib/esm/d-5MyulviS.js.map +0 -1
- package/lib/esm/diff-neOaT_vk.js +0 -31
- package/lib/esm/diff-neOaT_vk.js.map +0 -1
- package/lib/esm/dockerfile-lzx42-zz.js +0 -200
- package/lib/esm/dockerfile-lzx42-zz.js.map +0 -1
- package/lib/esm/dtd-FmzPLZcQ.js +0 -122
- package/lib/esm/dtd-FmzPLZcQ.js.map +0 -1
- package/lib/esm/dylan-1HtRK4GO.js +0 -338
- package/lib/esm/dylan-1HtRK4GO.js.map +0 -1
- package/lib/esm/ebnf-Nz-pnLHy.js +0 -152
- package/lib/esm/ebnf-Nz-pnLHy.js.map +0 -1
- package/lib/esm/ecl-lQsZhQz0.js +0 -191
- package/lib/esm/ecl-lQsZhQz0.js.map +0 -1
- package/lib/esm/eiffel-R_HiEkhx.js +0 -147
- package/lib/esm/eiffel-R_HiEkhx.js.map +0 -1
- package/lib/esm/elm-KYv4VTDg.js +0 -231
- package/lib/esm/elm-KYv4VTDg.js.map +0 -1
- package/lib/esm/erlang-7YaHCBIe.js +0 -582
- package/lib/esm/erlang-7YaHCBIe.js.map +0 -1
- package/lib/esm/factor-opBU9aTK.js +0 -66
- package/lib/esm/factor-opBU9aTK.js.map +0 -1
- package/lib/esm/fcl-jm31FmFz.js +0 -155
- package/lib/esm/fcl-jm31FmFz.js.map +0 -1
- package/lib/esm/floating-ui.dom-CAYjY8Gv.js +0 -1130
- package/lib/esm/floating-ui.dom-CAYjY8Gv.js.map +0 -1
- package/lib/esm/forth-5NKbjnWh.js +0 -165
- package/lib/esm/forth-5NKbjnWh.js.map +0 -1
- package/lib/esm/fortran-dXm_-cb9.js +0 -173
- package/lib/esm/fortran-dXm_-cb9.js.map +0 -1
- package/lib/esm/gas-nsYVnsy-.js +0 -344
- package/lib/esm/gas-nsYVnsy-.js.map +0 -1
- package/lib/esm/gherkin-fzKpjm3M.js +0 -148
- package/lib/esm/gherkin-fzKpjm3M.js.map +0 -1
- package/lib/esm/go-Pn1qh7yl.js +0 -165
- package/lib/esm/go-Pn1qh7yl.js.map +0 -1
- package/lib/esm/groovy-DZY-8keZ.js +0 -231
- package/lib/esm/groovy-DZY-8keZ.js.map +0 -1
- package/lib/esm/haskell-JGh2upDd.js +0 -240
- package/lib/esm/haskell-JGh2upDd.js.map +0 -1
- package/lib/esm/haxe-1hvVK-Fy.js +0 -491
- package/lib/esm/haxe-1hvVK-Fy.js.map +0 -1
- package/lib/esm/helper-wZAtC67x.js +0 -13
- package/lib/esm/helper-wZAtC67x.js.map +0 -1
- package/lib/esm/http-mY1M77wn.js +0 -90
- package/lib/esm/http-mY1M77wn.js.map +0 -1
- package/lib/esm/idl-dy_653wH.js +0 -275
- package/lib/esm/idl-dy_653wH.js.map +0 -1
- package/lib/esm/index-0-j8Icms.js +0 -384
- package/lib/esm/index-0-j8Icms.js.map +0 -1
- package/lib/esm/index-1l-61HI-.js +0 -358
- package/lib/esm/index-1l-61HI-.js.map +0 -1
- package/lib/esm/index-3HeWs5rX.js +0 -440
- package/lib/esm/index-3HeWs5rX.js.map +0 -1
- package/lib/esm/index-3bDzhU6z.js +0 -759
- package/lib/esm/index-3bDzhU6z.js.map +0 -1
- package/lib/esm/index-6GrVnloh.js +0 -1027
- package/lib/esm/index-6GrVnloh.js.map +0 -1
- package/lib/esm/index-8QJbxTYk.js +0 -1145
- package/lib/esm/index-8QJbxTYk.js.map +0 -1
- package/lib/esm/index-9w_hdnvb.js +0 -532
- package/lib/esm/index-9w_hdnvb.js.map +0 -1
- package/lib/esm/index-AOoFzBaK.js +0 -53
- package/lib/esm/index-AOoFzBaK.js.map +0 -1
- package/lib/esm/index-DS7Z4Ach.js +0 -686
- package/lib/esm/index-DS7Z4Ach.js.map +0 -1
- package/lib/esm/index-LAdX6LsO.js +0 -33805
- package/lib/esm/index-LAdX6LsO.js.map +0 -1
- package/lib/esm/index-MxgqkRtj.js +0 -125
- package/lib/esm/index-MxgqkRtj.js.map +0 -1
- package/lib/esm/index-NZ5-xr5_.js +0 -351
- package/lib/esm/index-NZ5-xr5_.js.map +0 -1
- package/lib/esm/index-OpUb5xP6.js +0 -1872
- package/lib/esm/index-OpUb5xP6.js.map +0 -1
- package/lib/esm/index-SDPCpsD5.js +0 -461
- package/lib/esm/index-SDPCpsD5.js.map +0 -1
- package/lib/esm/index-VP76m4nW.js +0 -157
- package/lib/esm/index-VP76m4nW.js.map +0 -1
- package/lib/esm/index-Vl0W0S3h.js +0 -259
- package/lib/esm/index-Vl0W0S3h.js.map +0 -1
- package/lib/esm/index-VoX_n1l_.js +0 -1038
- package/lib/esm/index-VoX_n1l_.js.map +0 -1
- package/lib/esm/index-XH7OnwZl.js +0 -527
- package/lib/esm/index-XH7OnwZl.js.map +0 -1
- package/lib/esm/index-Yuj7sNhQ.js +0 -105
- package/lib/esm/index-Yuj7sNhQ.js.map +0 -1
- package/lib/esm/index-_4fWmRbN.js +0 -206
- package/lib/esm/index-_4fWmRbN.js.map +0 -1
- package/lib/esm/index-bexsWrgs.js +0 -153
- package/lib/esm/index-bexsWrgs.js.map +0 -1
- package/lib/esm/index-chrnjY1D.js +0 -470
- package/lib/esm/index-chrnjY1D.js.map +0 -1
- package/lib/esm/index-eqd5wtjX.js +0 -393
- package/lib/esm/index-eqd5wtjX.js.map +0 -1
- package/lib/esm/index-g_3dzLYU.js +0 -200
- package/lib/esm/index-g_3dzLYU.js.map +0 -1
- package/lib/esm/index-grT-Kuf2.js +0 -78
- package/lib/esm/index-grT-Kuf2.js.map +0 -1
- package/lib/esm/index-hF04phbf.js +0 -189
- package/lib/esm/index-hF04phbf.js.map +0 -1
- package/lib/esm/index-i79QMXpJ.js +0 -25654
- package/lib/esm/index-i79QMXpJ.js.map +0 -1
- package/lib/esm/index-rvOBAXap.js +0 -2512
- package/lib/esm/index-rvOBAXap.js.map +0 -1
- package/lib/esm/index-uP9BKsTM.js +0 -446
- package/lib/esm/index-uP9BKsTM.js.map +0 -1
- package/lib/esm/index-ueQQMSgm.js +0 -1351
- package/lib/esm/index-ueQQMSgm.js.map +0 -1
- package/lib/esm/index-x8SyiPMC.js +0 -401
- package/lib/esm/index-x8SyiPMC.js.map +0 -1
- package/lib/esm/index-zrQXXSXm.js +0 -115
- package/lib/esm/index-zrQXXSXm.js.map +0 -1
- package/lib/esm/javascript-TMTz-YQH.js +0 -923
- package/lib/esm/javascript-TMTz-YQH.js.map +0 -1
- package/lib/esm/jinja2-sRIdliZK.js +0 -172
- package/lib/esm/jinja2-sRIdliZK.js.map +0 -1
- package/lib/esm/julia-fK0wmpGL.js +0 -370
- package/lib/esm/julia-fK0wmpGL.js.map +0 -1
- package/lib/esm/livescript-FRbAot3D.js +0 -260
- package/lib/esm/livescript-FRbAot3D.js.map +0 -1
- package/lib/esm/lua-t4FHEjvK.js +0 -138
- package/lib/esm/lua-t4FHEjvK.js.map +0 -1
- package/lib/esm/mathematica-sn_KGlYj.js +0 -154
- package/lib/esm/mathematica-sn_KGlYj.js.map +0 -1
- package/lib/esm/mbox-KvVC319E.js +0 -115
- package/lib/esm/mbox-KvVC319E.js.map +0 -1
- package/lib/esm/mirc-PzJ0zKSk.js +0 -177
- package/lib/esm/mirc-PzJ0zKSk.js.map +0 -1
- package/lib/esm/mllike-ZK411xkN.js +0 -347
- package/lib/esm/mllike-ZK411xkN.js.map +0 -1
- package/lib/esm/modelica-ZaHlRCbp.js +0 -193
- package/lib/esm/modelica-ZaHlRCbp.js.map +0 -1
- package/lib/esm/mscgen-Kkq4o4Zm.js +0 -150
- package/lib/esm/mscgen-Kkq4o4Zm.js.map +0 -1
- package/lib/esm/mumps-M8a87-rl.js +0 -130
- package/lib/esm/mumps-M8a87-rl.js.map +0 -1
- package/lib/esm/nginx-2LJIX23E.js +0 -164
- package/lib/esm/nginx-2LJIX23E.js.map +0 -1
- package/lib/esm/nsis-zvfFgMLi.js +0 -81
- package/lib/esm/nsis-zvfFgMLi.js.map +0 -1
- package/lib/esm/ntriples-tVkHy5bk.js +0 -142
- package/lib/esm/ntriples-tVkHy5bk.js.map +0 -1
- package/lib/esm/octave-mE4T5MF5.js +0 -113
- package/lib/esm/octave-mE4T5MF5.js.map +0 -1
- package/lib/esm/oz-q-LCsuVg.js +0 -236
- package/lib/esm/oz-q-LCsuVg.js.map +0 -1
- package/lib/esm/pascal-0IgUAn4C.js +0 -125
- package/lib/esm/pascal-0IgUAn4C.js.map +0 -1
- package/lib/esm/perl-AqxdYGac.js +0 -820
- package/lib/esm/perl-AqxdYGac.js.map +0 -1
- package/lib/esm/pig-ESM-IjQj.js +0 -150
- package/lib/esm/pig-ESM-IjQj.js.map +0 -1
- package/lib/esm/powershell-CLFP0L55.js +0 -382
- package/lib/esm/powershell-CLFP0L55.js.map +0 -1
- package/lib/esm/properties-oWHNzvb9.js +0 -63
- package/lib/esm/properties-oWHNzvb9.js.map +0 -1
- package/lib/esm/protobuf-c7eMmdcc.js +0 -55
- package/lib/esm/protobuf-c7eMmdcc.js.map +0 -1
- package/lib/esm/puppet-FjzvdRJr.js +0 -206
- package/lib/esm/puppet-FjzvdRJr.js.map +0 -1
- package/lib/esm/python-3Pv0tnvt.js +0 -390
- package/lib/esm/python-3Pv0tnvt.js.map +0 -1
- package/lib/esm/q-IImW8da6.js +0 -124
- package/lib/esm/q-IImW8da6.js.map +0 -1
- package/lib/esm/r-CnEkTvR0.js +0 -175
- package/lib/esm/r-CnEkTvR0.js.map +0 -1
- package/lib/esm/rpm-Q55-fEHj.js +0 -90
- package/lib/esm/rpm-Q55-fEHj.js.map +0 -1
- package/lib/esm/ruby-zhaGB3Kh.js +0 -288
- package/lib/esm/ruby-zhaGB3Kh.js.map +0 -1
- package/lib/esm/sas-Ur9jZIOV.js +0 -269
- package/lib/esm/sas-Ur9jZIOV.js.map +0 -1
- package/lib/esm/schema-JWJqD9qa.js +0 -71
- package/lib/esm/schema-JWJqD9qa.js.map +0 -1
- package/lib/esm/scheme-daT5-Rya.js +0 -264
- package/lib/esm/scheme-daT5-Rya.js.map +0 -1
- package/lib/esm/shell-cwFL0AYP.js +0 -146
- package/lib/esm/shell-cwFL0AYP.js.map +0 -1
- package/lib/esm/sieve-MlNXFFUq.js +0 -179
- package/lib/esm/sieve-MlNXFFUq.js.map +0 -1
- package/lib/esm/simple-mode-m1rsX7Gw.js +0 -136
- package/lib/esm/simple-mode-m1rsX7Gw.js.map +0 -1
- package/lib/esm/smalltalk-xrQICp9e.js +0 -154
- package/lib/esm/smalltalk-xrQICp9e.js.map +0 -1
- package/lib/esm/solr-PU3oPgQz.js +0 -81
- package/lib/esm/solr-PU3oPgQz.js.map +0 -1
- package/lib/esm/sparql--u8NRBii.js +0 -171
- package/lib/esm/sparql--u8NRBii.js.map +0 -1
- package/lib/esm/spreadsheet-QCp0LifX.js +0 -99
- package/lib/esm/spreadsheet-QCp0LifX.js.map +0 -1
- package/lib/esm/sql-dsGfl64h.js +0 -482
- package/lib/esm/sql-dsGfl64h.js.map +0 -1
- package/lib/esm/stex-WcLBzvkD.js +0 -247
- package/lib/esm/stex-WcLBzvkD.js.map +0 -1
- package/lib/esm/stylus--A5XAqOX.js +0 -751
- package/lib/esm/stylus--A5XAqOX.js.map +0 -1
- package/lib/esm/swift-qAm73i7G.js +0 -203
- package/lib/esm/swift-qAm73i7G.js.map +0 -1
- package/lib/esm/tcl-Kdc7qxc-.js +0 -126
- package/lib/esm/tcl-Kdc7qxc-.js.map +0 -1
- package/lib/esm/textile--sz8UrIz.js +0 -442
- package/lib/esm/textile--sz8UrIz.js.map +0 -1
- package/lib/esm/tiddlywiki-xNXTeBlQ.js +0 -279
- package/lib/esm/tiddlywiki-xNXTeBlQ.js.map +0 -1
- package/lib/esm/tiki-LCXjrNH3.js +0 -290
- package/lib/esm/tiki-LCXjrNH3.js.map +0 -1
- package/lib/esm/todoList-M-PGJKde.js.map +0 -1
- package/lib/esm/toml-Ac4tlBMn.js +0 -76
- package/lib/esm/toml-Ac4tlBMn.js.map +0 -1
- package/lib/esm/tooltip-plugin-iw2EQWIG.js +0 -185
- package/lib/esm/tooltip-plugin-iw2EQWIG.js.map +0 -1
- package/lib/esm/troff-LLW1x1Yz.js +0 -65
- package/lib/esm/troff-LLW1x1Yz.js.map +0 -1
- package/lib/esm/ttcn-ZYZ9FS3u.js +0 -258
- package/lib/esm/ttcn-ZYZ9FS3u.js.map +0 -1
- package/lib/esm/ttcn-cfg-qsvf3MfB.js +0 -202
- package/lib/esm/ttcn-cfg-qsvf3MfB.js.map +0 -1
- package/lib/esm/turtle-wq3TqOth.js +0 -142
- package/lib/esm/turtle-wq3TqOth.js.map +0 -1
- package/lib/esm/vb-86M_JuNP.js +0 -250
- package/lib/esm/vb-86M_JuNP.js.map +0 -1
- package/lib/esm/vbscript-GueAeVug.js +0 -321
- package/lib/esm/vbscript-GueAeVug.js.map +0 -1
- package/lib/esm/velocity-7PW9GXO2.js +0 -187
- package/lib/esm/velocity-7PW9GXO2.js.map +0 -1
- package/lib/esm/verilog-PXtXH14C.js +0 -566
- package/lib/esm/verilog-PXtXH14C.js.map +0 -1
- package/lib/esm/vhdl-I8eyK83X.js +0 -175
- package/lib/esm/vhdl-I8eyK83X.js.map +0 -1
- package/lib/esm/webidl-1f8ATJ66.js +0 -180
- package/lib/esm/webidl-1f8ATJ66.js.map +0 -1
- package/lib/esm/xquery-IYp28Wx6.js +0 -426
- package/lib/esm/xquery-IYp28Wx6.js.map +0 -1
- package/lib/esm/yacas-wkENB05f.js +0 -183
- package/lib/esm/yacas-wkENB05f.js.map +0 -1
- package/lib/esm/z80-GaXiLdiV.js +0 -103
- package/lib/esm/z80-GaXiLdiV.js.map +0 -1
|
@@ -1,1147 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var todoList = require('./todoList-Ze4FLMlx.js');
|
|
4
|
-
var index = require('./index-tBw4NmwY.js');
|
|
5
|
-
var state = require('@milkdown/prose/state');
|
|
6
|
-
var prose = require('@milkdown/prose');
|
|
7
|
-
var tables = require('@milkdown/prose/tables');
|
|
8
|
-
var helper = require('./helper-1aludV1Z.js');
|
|
9
|
-
var atomico = require('atomico');
|
|
10
|
-
var clsx = require('./clsx-dASsG01A.js');
|
|
11
|
-
var index$1 = require('./index-28q261C7.js');
|
|
12
|
-
var floatingUi_dom = require('./floating-ui.dom-2cjBpir5.js');
|
|
13
|
-
var $view = require('./_view-N32ied53.js');
|
|
14
|
-
require('@milkdown/prose/model');
|
|
15
|
-
require('@milkdown/prose/commands');
|
|
16
|
-
require('@milkdown/prose/inputrules');
|
|
17
|
-
require('@milkdown/prose/keymap');
|
|
18
|
-
require('@milkdown/prose/view');
|
|
19
|
-
require('@milkdown/prose/schema-list');
|
|
20
|
-
require('@milkdown/prose/transform');
|
|
21
|
-
require('@milkdown/prose/history');
|
|
22
|
-
|
|
23
|
-
const defaultTableBlockConfig = {
|
|
24
|
-
renderButton: (renderType) => {
|
|
25
|
-
switch (renderType) {
|
|
26
|
-
case "add_row":
|
|
27
|
-
return "+";
|
|
28
|
-
case "add_col":
|
|
29
|
-
return "+";
|
|
30
|
-
case "delete_row":
|
|
31
|
-
return "-";
|
|
32
|
-
case "delete_col":
|
|
33
|
-
return "-";
|
|
34
|
-
case "align_col_left":
|
|
35
|
-
return "left";
|
|
36
|
-
case "align_col_center":
|
|
37
|
-
return "center";
|
|
38
|
-
case "align_col_right":
|
|
39
|
-
return "right";
|
|
40
|
-
case "col_drag_handle":
|
|
41
|
-
return "=";
|
|
42
|
-
case "row_drag_handle":
|
|
43
|
-
return "=";
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const tableBlockConfig = index.$ctx({ ...defaultTableBlockConfig }, "tableBlockConfigCtx");
|
|
48
|
-
todoList.withMeta(tableBlockConfig, {
|
|
49
|
-
displayName: "Config<table-block>",
|
|
50
|
-
group: "TableBlock"
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
function findNodeIndex(parent, child) {
|
|
54
|
-
for (let i = 0; i < parent.childCount; i++) {
|
|
55
|
-
if (parent.child(i) === child)
|
|
56
|
-
return i;
|
|
57
|
-
}
|
|
58
|
-
return -1;
|
|
59
|
-
}
|
|
60
|
-
function findPointerIndex(event, view) {
|
|
61
|
-
var _a, _b, _c;
|
|
62
|
-
if (!view)
|
|
63
|
-
return;
|
|
64
|
-
const posAtCoords = view.posAtCoords({ left: event.clientX, top: event.clientY });
|
|
65
|
-
if (!posAtCoords)
|
|
66
|
-
return;
|
|
67
|
-
const pos = posAtCoords == null ? void 0 : posAtCoords.inside;
|
|
68
|
-
if (pos == null || pos < 0)
|
|
69
|
-
return;
|
|
70
|
-
const $pos = view.state.doc.resolve(pos);
|
|
71
|
-
const node = view.state.doc.nodeAt(pos);
|
|
72
|
-
if (!node)
|
|
73
|
-
return;
|
|
74
|
-
const cellType = ["table_cell", "table_header"];
|
|
75
|
-
const rowType = ["table_row", "table_header_row"];
|
|
76
|
-
const cell = cellType.includes(node.type.name) ? node : (_a = prose.findParent((node2) => cellType.includes(node2.type.name))($pos)) == null ? void 0 : _a.node;
|
|
77
|
-
const row = (_b = prose.findParent((node2) => rowType.includes(node2.type.name))($pos)) == null ? void 0 : _b.node;
|
|
78
|
-
const table = (_c = prose.findParent((node2) => node2.type.name === "table")($pos)) == null ? void 0 : _c.node;
|
|
79
|
-
if (!cell || !row || !table)
|
|
80
|
-
return;
|
|
81
|
-
const columnIndex = findNodeIndex(row, cell);
|
|
82
|
-
const rowIndex = findNodeIndex(table, row);
|
|
83
|
-
return [rowIndex, columnIndex];
|
|
84
|
-
}
|
|
85
|
-
function getRelatedDOM(contentWrapperRef, [rowIndex, columnIndex]) {
|
|
86
|
-
const content = contentWrapperRef.current;
|
|
87
|
-
if (!content)
|
|
88
|
-
return;
|
|
89
|
-
const rows = content.querySelectorAll("tr");
|
|
90
|
-
const row = rows[rowIndex];
|
|
91
|
-
if (!row)
|
|
92
|
-
return;
|
|
93
|
-
const firstRow = rows[0];
|
|
94
|
-
if (!firstRow)
|
|
95
|
-
return;
|
|
96
|
-
const headerCol = firstRow.children[columnIndex];
|
|
97
|
-
if (!headerCol)
|
|
98
|
-
return;
|
|
99
|
-
const col = row.children[columnIndex];
|
|
100
|
-
if (!col)
|
|
101
|
-
return;
|
|
102
|
-
return {
|
|
103
|
-
row,
|
|
104
|
-
col,
|
|
105
|
-
headerCol
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
function recoveryStateBetweenUpdate(refs, ctx, node) {
|
|
109
|
-
if (!ctx)
|
|
110
|
-
return;
|
|
111
|
-
if (!node)
|
|
112
|
-
return;
|
|
113
|
-
const { selection } = ctx.get(index.editorViewCtx).state;
|
|
114
|
-
if (!(selection instanceof tables.CellSelection))
|
|
115
|
-
return;
|
|
116
|
-
const { $from } = selection;
|
|
117
|
-
const table = index.findTable($from);
|
|
118
|
-
if (!table || table.node !== node)
|
|
119
|
-
return;
|
|
120
|
-
if (selection.isColSelection()) {
|
|
121
|
-
const { $head } = selection;
|
|
122
|
-
const colIndex = $head.index($head.depth - 1);
|
|
123
|
-
computeColHandlePositionByIndex({
|
|
124
|
-
refs,
|
|
125
|
-
index: [0, colIndex],
|
|
126
|
-
before: (handleDOM) => {
|
|
127
|
-
var _a;
|
|
128
|
-
(_a = handleDOM.querySelector(".button-group")) == null ? void 0 : _a.setAttribute("data-show", "true");
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
if (selection.isRowSelection()) {
|
|
134
|
-
const { $head } = selection;
|
|
135
|
-
const rowNode = prose.findParent((node2) => node2.type.name === "table_row" || node2.type.name === "table_header_row")($head);
|
|
136
|
-
if (!rowNode)
|
|
137
|
-
return;
|
|
138
|
-
const rowIndex = findNodeIndex(table.node, rowNode.node);
|
|
139
|
-
computeRowHandlePositionByIndex({
|
|
140
|
-
refs,
|
|
141
|
-
index: [rowIndex, 0],
|
|
142
|
-
before: (handleDOM) => {
|
|
143
|
-
var _a;
|
|
144
|
-
if (rowIndex > 0)
|
|
145
|
-
(_a = handleDOM.querySelector(".button-group")) == null ? void 0 : _a.setAttribute("data-show", "true");
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
function computeColHandlePositionByIndex({
|
|
151
|
-
refs,
|
|
152
|
-
index,
|
|
153
|
-
before,
|
|
154
|
-
after
|
|
155
|
-
}) {
|
|
156
|
-
const {
|
|
157
|
-
contentWrapperRef,
|
|
158
|
-
colHandleRef,
|
|
159
|
-
hoverIndex
|
|
160
|
-
} = refs;
|
|
161
|
-
const colHandle = colHandleRef.current;
|
|
162
|
-
if (!colHandle)
|
|
163
|
-
return;
|
|
164
|
-
hoverIndex.current = index;
|
|
165
|
-
const dom = getRelatedDOM(contentWrapperRef, index);
|
|
166
|
-
if (!dom)
|
|
167
|
-
return;
|
|
168
|
-
const { headerCol: col } = dom;
|
|
169
|
-
colHandle.dataset.show = "true";
|
|
170
|
-
if (before)
|
|
171
|
-
before(colHandle);
|
|
172
|
-
floatingUi_dom.computePosition(col, colHandle, { placement: "top" }).then(({ x, y }) => {
|
|
173
|
-
Object.assign(colHandle.style, {
|
|
174
|
-
left: `${x}px`,
|
|
175
|
-
top: `${y}px`
|
|
176
|
-
});
|
|
177
|
-
if (after)
|
|
178
|
-
after(colHandle);
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
function computeRowHandlePositionByIndex({
|
|
182
|
-
refs,
|
|
183
|
-
index,
|
|
184
|
-
before,
|
|
185
|
-
after
|
|
186
|
-
}) {
|
|
187
|
-
const {
|
|
188
|
-
contentWrapperRef,
|
|
189
|
-
rowHandleRef,
|
|
190
|
-
hoverIndex
|
|
191
|
-
} = refs;
|
|
192
|
-
const rowHandle = rowHandleRef.current;
|
|
193
|
-
if (!rowHandle)
|
|
194
|
-
return;
|
|
195
|
-
hoverIndex.current = index;
|
|
196
|
-
const dom = getRelatedDOM(contentWrapperRef, index);
|
|
197
|
-
if (!dom)
|
|
198
|
-
return;
|
|
199
|
-
const { row } = dom;
|
|
200
|
-
rowHandle.dataset.show = "true";
|
|
201
|
-
if (before)
|
|
202
|
-
before(rowHandle);
|
|
203
|
-
floatingUi_dom.computePosition(row, rowHandle, { placement: "left" }).then(({ x, y }) => {
|
|
204
|
-
Object.assign(rowHandle.style, {
|
|
205
|
-
left: `${x}px`,
|
|
206
|
-
top: `${y}px`
|
|
207
|
-
});
|
|
208
|
-
if (after)
|
|
209
|
-
after(rowHandle);
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
function prepareDndContext(refs) {
|
|
214
|
-
const {
|
|
215
|
-
dragPreviewRef,
|
|
216
|
-
tableWrapperRef,
|
|
217
|
-
contentWrapperRef,
|
|
218
|
-
yLineHandleRef,
|
|
219
|
-
xLineHandleRef,
|
|
220
|
-
colHandleRef,
|
|
221
|
-
rowHandleRef
|
|
222
|
-
} = refs;
|
|
223
|
-
const preview = dragPreviewRef.current;
|
|
224
|
-
if (!preview)
|
|
225
|
-
return;
|
|
226
|
-
const wrapper = tableWrapperRef.current;
|
|
227
|
-
if (!wrapper)
|
|
228
|
-
return;
|
|
229
|
-
const content = contentWrapperRef.current;
|
|
230
|
-
if (!content)
|
|
231
|
-
return;
|
|
232
|
-
const contentRoot = content.querySelector("tbody");
|
|
233
|
-
if (!contentRoot)
|
|
234
|
-
return;
|
|
235
|
-
const previewRoot = preview.querySelector("tbody");
|
|
236
|
-
if (!previewRoot)
|
|
237
|
-
return;
|
|
238
|
-
const yHandle = yLineHandleRef.current;
|
|
239
|
-
if (!yHandle)
|
|
240
|
-
return;
|
|
241
|
-
const xHandle = xLineHandleRef.current;
|
|
242
|
-
if (!xHandle)
|
|
243
|
-
return;
|
|
244
|
-
const colHandle = colHandleRef.current;
|
|
245
|
-
if (!colHandle)
|
|
246
|
-
return;
|
|
247
|
-
const rowHandle = rowHandleRef.current;
|
|
248
|
-
if (!rowHandle)
|
|
249
|
-
return;
|
|
250
|
-
const context = {
|
|
251
|
-
preview,
|
|
252
|
-
wrapper,
|
|
253
|
-
content,
|
|
254
|
-
contentRoot,
|
|
255
|
-
previewRoot,
|
|
256
|
-
yHandle,
|
|
257
|
-
xHandle,
|
|
258
|
-
colHandle,
|
|
259
|
-
rowHandle
|
|
260
|
-
};
|
|
261
|
-
return context;
|
|
262
|
-
}
|
|
263
|
-
function handleDrag(refs, event, ctx, fn) {
|
|
264
|
-
const view = ctx == null ? void 0 : ctx.get(index.editorViewCtx);
|
|
265
|
-
if (!(view == null ? void 0 : view.editable))
|
|
266
|
-
return;
|
|
267
|
-
event.stopPropagation();
|
|
268
|
-
if (event.dataTransfer)
|
|
269
|
-
event.dataTransfer.effectAllowed = "move";
|
|
270
|
-
const context = prepareDndContext(refs);
|
|
271
|
-
if (!context)
|
|
272
|
-
return;
|
|
273
|
-
requestAnimationFrame(() => {
|
|
274
|
-
fn(context);
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
function createDragRowHandler(refs, ctx) {
|
|
278
|
-
return (event) => {
|
|
279
|
-
handleDrag(refs, event, ctx, ({
|
|
280
|
-
preview,
|
|
281
|
-
content,
|
|
282
|
-
previewRoot,
|
|
283
|
-
yHandle,
|
|
284
|
-
xHandle,
|
|
285
|
-
colHandle,
|
|
286
|
-
rowHandle
|
|
287
|
-
}) => {
|
|
288
|
-
var _a;
|
|
289
|
-
const { hoverIndex, dragInfo } = refs;
|
|
290
|
-
xHandle.dataset.displayType = "indicator";
|
|
291
|
-
yHandle.dataset.show = "false";
|
|
292
|
-
colHandle.dataset.show = "false";
|
|
293
|
-
(_a = rowHandle.querySelector(".button-group")) == null ? void 0 : _a.setAttribute("data-show", "false");
|
|
294
|
-
const [rowIndex] = hoverIndex.current;
|
|
295
|
-
dragInfo.current = {
|
|
296
|
-
startCoords: [event.clientX, event.clientY],
|
|
297
|
-
startIndex: rowIndex,
|
|
298
|
-
endIndex: rowIndex,
|
|
299
|
-
type: "row"
|
|
300
|
-
};
|
|
301
|
-
preview.dataset.direction = "vertical";
|
|
302
|
-
const rows = content.querySelectorAll("tr");
|
|
303
|
-
while (previewRoot.firstChild)
|
|
304
|
-
previewRoot.removeChild(previewRoot.firstChild);
|
|
305
|
-
const row = rows[rowIndex];
|
|
306
|
-
if (!row)
|
|
307
|
-
return;
|
|
308
|
-
previewRoot.appendChild(row.cloneNode(true));
|
|
309
|
-
const height = row.getBoundingClientRect().height;
|
|
310
|
-
const { width } = content.querySelector("tbody").getBoundingClientRect();
|
|
311
|
-
Object.assign(preview.style, {
|
|
312
|
-
width: `${width}px`,
|
|
313
|
-
height: `${height}px`
|
|
314
|
-
});
|
|
315
|
-
preview.dataset.show = "true";
|
|
316
|
-
});
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
function createDragColHandler(refs, ctx) {
|
|
320
|
-
return (event) => {
|
|
321
|
-
handleDrag(refs, event, ctx, ({
|
|
322
|
-
preview,
|
|
323
|
-
content,
|
|
324
|
-
previewRoot,
|
|
325
|
-
yHandle,
|
|
326
|
-
xHandle,
|
|
327
|
-
colHandle,
|
|
328
|
-
rowHandle
|
|
329
|
-
}) => {
|
|
330
|
-
var _a;
|
|
331
|
-
const { hoverIndex, dragInfo } = refs;
|
|
332
|
-
xHandle.dataset.show = "false";
|
|
333
|
-
yHandle.dataset.displayType = "indicator";
|
|
334
|
-
rowHandle.dataset.show = "false";
|
|
335
|
-
(_a = colHandle.querySelector(".button-group")) == null ? void 0 : _a.setAttribute("data-show", "false");
|
|
336
|
-
const [_, colIndex] = hoverIndex.current;
|
|
337
|
-
dragInfo.current = {
|
|
338
|
-
startCoords: [event.clientX, event.clientY],
|
|
339
|
-
startIndex: colIndex,
|
|
340
|
-
endIndex: colIndex,
|
|
341
|
-
type: "col"
|
|
342
|
-
};
|
|
343
|
-
preview.dataset.direction = "horizontal";
|
|
344
|
-
const rows = content.querySelectorAll("tr");
|
|
345
|
-
while (previewRoot.firstChild)
|
|
346
|
-
previewRoot.removeChild(previewRoot.firstChild);
|
|
347
|
-
let width;
|
|
348
|
-
Array.from(rows).forEach((row) => {
|
|
349
|
-
const col = row.children[colIndex];
|
|
350
|
-
if (!col)
|
|
351
|
-
return;
|
|
352
|
-
if (width === void 0)
|
|
353
|
-
width = col.getBoundingClientRect().width;
|
|
354
|
-
const tr = col.parentElement.cloneNode(false);
|
|
355
|
-
const clone = col.cloneNode(true);
|
|
356
|
-
tr.appendChild(clone);
|
|
357
|
-
previewRoot.appendChild(tr);
|
|
358
|
-
});
|
|
359
|
-
const { height } = content.querySelector("tbody").getBoundingClientRect();
|
|
360
|
-
Object.assign(preview.style, {
|
|
361
|
-
width: `${width}px`,
|
|
362
|
-
height: `${height}px`
|
|
363
|
-
});
|
|
364
|
-
preview.dataset.show = "true";
|
|
365
|
-
});
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
function createDragOverHandler(refs) {
|
|
369
|
-
return index$1.throttle((e) => {
|
|
370
|
-
const context = prepareDndContext(refs);
|
|
371
|
-
if (!context)
|
|
372
|
-
return;
|
|
373
|
-
const {
|
|
374
|
-
preview,
|
|
375
|
-
content,
|
|
376
|
-
contentRoot,
|
|
377
|
-
xHandle,
|
|
378
|
-
yHandle
|
|
379
|
-
} = context;
|
|
380
|
-
const {
|
|
381
|
-
dragInfo,
|
|
382
|
-
hoverIndex
|
|
383
|
-
} = refs;
|
|
384
|
-
if (preview.dataset.show === "false")
|
|
385
|
-
return;
|
|
386
|
-
const dom = getRelatedDOM(refs.contentWrapperRef, hoverIndex.current);
|
|
387
|
-
if (!dom)
|
|
388
|
-
return;
|
|
389
|
-
const firstRow = contentRoot.querySelector("tr");
|
|
390
|
-
if (!firstRow)
|
|
391
|
-
return;
|
|
392
|
-
const info = dragInfo.current;
|
|
393
|
-
if (!info)
|
|
394
|
-
return;
|
|
395
|
-
const wrapperOffsetTop = contentRoot.offsetParent.offsetTop;
|
|
396
|
-
const wrapperOffsetLeft = contentRoot.offsetParent.offsetLeft;
|
|
397
|
-
if (info.type === "col") {
|
|
398
|
-
const width = dom.col.getBoundingClientRect().width;
|
|
399
|
-
const { left, width: fullWidth } = contentRoot.getBoundingClientRect();
|
|
400
|
-
const leftGap = wrapperOffsetLeft - left;
|
|
401
|
-
const previewLeft = e.clientX + leftGap - width / 2;
|
|
402
|
-
const previewRight = e.clientX + leftGap + width / 2;
|
|
403
|
-
const [startX] = info.startCoords;
|
|
404
|
-
const direction = startX < e.clientX ? "right" : "left";
|
|
405
|
-
preview.style.top = `${wrapperOffsetTop}px`;
|
|
406
|
-
const previewLeftOffset = previewLeft < left + leftGap - 20 ? left + leftGap - 20 : previewLeft > left + fullWidth + leftGap - width + 20 ? left + fullWidth + leftGap - width + 20 : previewLeft;
|
|
407
|
-
preview.style.left = `${previewLeftOffset}px`;
|
|
408
|
-
const children = Array.from(firstRow.children);
|
|
409
|
-
const col = children.find((col2, index) => {
|
|
410
|
-
const boundary = col2.getBoundingClientRect();
|
|
411
|
-
const boundaryLeft = boundary.left + wrapperOffsetLeft - left;
|
|
412
|
-
const boundaryRight = boundary.right + wrapperOffsetLeft - left;
|
|
413
|
-
if (direction === "right") {
|
|
414
|
-
if (boundaryLeft <= previewRight && boundaryRight >= previewRight)
|
|
415
|
-
return true;
|
|
416
|
-
if (index === firstRow.children.length - 1 && previewRight > boundaryRight)
|
|
417
|
-
return true;
|
|
418
|
-
} else {
|
|
419
|
-
if (boundaryLeft <= previewLeft && boundaryRight >= previewLeft)
|
|
420
|
-
return true;
|
|
421
|
-
if (index === 0 && previewLeft < boundaryLeft)
|
|
422
|
-
return true;
|
|
423
|
-
}
|
|
424
|
-
return false;
|
|
425
|
-
});
|
|
426
|
-
if (col) {
|
|
427
|
-
const yHandleWidth = yHandle.getBoundingClientRect().width;
|
|
428
|
-
const contentBoundary = content.getBoundingClientRect();
|
|
429
|
-
const index = children.indexOf(col);
|
|
430
|
-
info.endIndex = index;
|
|
431
|
-
floatingUi_dom.computePosition(col, yHandle, {
|
|
432
|
-
placement: direction === "left" ? "left" : "right",
|
|
433
|
-
middleware: [floatingUi_dom.offset(direction === "left" ? -1 * yHandleWidth : 0)]
|
|
434
|
-
}).then(({ x }) => {
|
|
435
|
-
yHandle.dataset.show = "true";
|
|
436
|
-
Object.assign(yHandle.style, {
|
|
437
|
-
height: `${contentBoundary.height}px`,
|
|
438
|
-
left: `${x}px`,
|
|
439
|
-
top: `${wrapperOffsetTop}px`
|
|
440
|
-
});
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
} else if (info.type === "row") {
|
|
444
|
-
const height = dom.row.getBoundingClientRect().height;
|
|
445
|
-
const { top, height: fullHeight } = contentRoot.getBoundingClientRect();
|
|
446
|
-
const topGap = wrapperOffsetTop - top;
|
|
447
|
-
const previewTop = e.clientY + topGap - height / 2;
|
|
448
|
-
const previewBottom = e.clientY + topGap + height / 2;
|
|
449
|
-
const [_, startY] = info.startCoords;
|
|
450
|
-
const direction = startY < e.clientY ? "down" : "up";
|
|
451
|
-
const previewTopOffset = previewTop < top + topGap - 20 ? top + topGap - 20 : previewTop > top + fullHeight + topGap - height + 20 ? top + fullHeight + topGap - height + 20 : previewTop;
|
|
452
|
-
preview.style.top = `${previewTopOffset}px`;
|
|
453
|
-
preview.style.left = `${wrapperOffsetLeft}px`;
|
|
454
|
-
const rows = Array.from(contentRoot.querySelectorAll("tr"));
|
|
455
|
-
const row = rows.find((row2, index) => {
|
|
456
|
-
const boundary = row2.getBoundingClientRect();
|
|
457
|
-
const boundaryTop = boundary.top + wrapperOffsetTop - top;
|
|
458
|
-
const boundaryBottom = boundary.bottom + wrapperOffsetTop - top;
|
|
459
|
-
if (direction === "down") {
|
|
460
|
-
if (boundaryTop <= previewBottom && boundaryBottom >= previewBottom)
|
|
461
|
-
return true;
|
|
462
|
-
if (index === rows.length - 1 && previewBottom > boundaryBottom)
|
|
463
|
-
return true;
|
|
464
|
-
} else {
|
|
465
|
-
if (boundaryTop <= previewTop && boundaryBottom >= previewTop)
|
|
466
|
-
return true;
|
|
467
|
-
if (index === 0 && previewTop < boundaryTop)
|
|
468
|
-
return true;
|
|
469
|
-
}
|
|
470
|
-
return false;
|
|
471
|
-
});
|
|
472
|
-
if (row) {
|
|
473
|
-
const xHandleHeight = xHandle.getBoundingClientRect().height;
|
|
474
|
-
const contentBoundary = content.getBoundingClientRect();
|
|
475
|
-
const index = rows.indexOf(row);
|
|
476
|
-
info.endIndex = index;
|
|
477
|
-
floatingUi_dom.computePosition(row, xHandle, {
|
|
478
|
-
placement: direction === "up" ? "top" : "bottom",
|
|
479
|
-
middleware: [floatingUi_dom.offset(direction === "up" ? -1 * xHandleHeight : 0)]
|
|
480
|
-
}).then(({ y }) => {
|
|
481
|
-
xHandle.dataset.show = "true";
|
|
482
|
-
Object.assign(xHandle.style, {
|
|
483
|
-
width: `${contentBoundary.width}px`,
|
|
484
|
-
top: `${y}px`
|
|
485
|
-
});
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
}, 20);
|
|
490
|
-
}
|
|
491
|
-
function useDragHandlers(refs, ctx, getPos) {
|
|
492
|
-
const {
|
|
493
|
-
dragPreviewRef,
|
|
494
|
-
yLineHandleRef,
|
|
495
|
-
xLineHandleRef,
|
|
496
|
-
dragInfo
|
|
497
|
-
} = refs;
|
|
498
|
-
const host = atomico.useHost();
|
|
499
|
-
const root = atomico.useMemo(() => host.current.getRootNode(), [host]);
|
|
500
|
-
const dragRow = atomico.useMemo(() => createDragRowHandler(refs, ctx), [refs]);
|
|
501
|
-
const dragCol = atomico.useMemo(() => createDragColHandler(refs, ctx), [refs]);
|
|
502
|
-
atomico.useEffect(() => {
|
|
503
|
-
const onDragEnd = () => {
|
|
504
|
-
const preview = dragPreviewRef.current;
|
|
505
|
-
if (!preview)
|
|
506
|
-
return;
|
|
507
|
-
if (preview.dataset.show === "false")
|
|
508
|
-
return;
|
|
509
|
-
const previewRoot = preview == null ? void 0 : preview.querySelector("tbody");
|
|
510
|
-
while (previewRoot == null ? void 0 : previewRoot.firstChild)
|
|
511
|
-
previewRoot == null ? void 0 : previewRoot.removeChild(previewRoot.firstChild);
|
|
512
|
-
if (preview)
|
|
513
|
-
preview.dataset.show = "false";
|
|
514
|
-
};
|
|
515
|
-
const onDrop = () => {
|
|
516
|
-
var _a;
|
|
517
|
-
const preview = dragPreviewRef.current;
|
|
518
|
-
if (!preview)
|
|
519
|
-
return;
|
|
520
|
-
const yHandle = yLineHandleRef.current;
|
|
521
|
-
if (!yHandle)
|
|
522
|
-
return;
|
|
523
|
-
const xHandle = xLineHandleRef.current;
|
|
524
|
-
if (!xHandle)
|
|
525
|
-
return;
|
|
526
|
-
const info = dragInfo.current;
|
|
527
|
-
if (!info)
|
|
528
|
-
return;
|
|
529
|
-
if (!ctx)
|
|
530
|
-
return;
|
|
531
|
-
if (preview.dataset.show === "false")
|
|
532
|
-
return;
|
|
533
|
-
const colHandle = refs.colHandleRef.current;
|
|
534
|
-
if (!colHandle)
|
|
535
|
-
return;
|
|
536
|
-
const rowHandle = refs.rowHandleRef.current;
|
|
537
|
-
if (!rowHandle)
|
|
538
|
-
return;
|
|
539
|
-
yHandle.dataset.show = "false";
|
|
540
|
-
xHandle.dataset.show = "false";
|
|
541
|
-
if (info.startIndex === info.endIndex)
|
|
542
|
-
return;
|
|
543
|
-
const commands = ctx.get(index.commandsCtx);
|
|
544
|
-
const payload = {
|
|
545
|
-
from: info.startIndex,
|
|
546
|
-
to: info.endIndex,
|
|
547
|
-
pos: ((_a = getPos == null ? void 0 : getPos()) != null ? _a : 0) + 1
|
|
548
|
-
};
|
|
549
|
-
if (info.type === "col") {
|
|
550
|
-
commands.call(index.selectColCommand.key, {
|
|
551
|
-
pos: payload.pos,
|
|
552
|
-
index: info.startIndex
|
|
553
|
-
});
|
|
554
|
-
commands.call(index.moveColCommand.key, payload);
|
|
555
|
-
const index$1 = [0, info.endIndex];
|
|
556
|
-
computeColHandlePositionByIndex({
|
|
557
|
-
refs,
|
|
558
|
-
index: index$1
|
|
559
|
-
});
|
|
560
|
-
} else {
|
|
561
|
-
commands.call(index.selectRowCommand.key, {
|
|
562
|
-
pos: payload.pos,
|
|
563
|
-
index: info.startIndex
|
|
564
|
-
});
|
|
565
|
-
commands.call(index.moveRowCommand.key, payload);
|
|
566
|
-
const index$1 = [info.endIndex, 0];
|
|
567
|
-
computeRowHandlePositionByIndex({
|
|
568
|
-
refs,
|
|
569
|
-
index: index$1
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
};
|
|
573
|
-
const onDragOver = createDragOverHandler(refs);
|
|
574
|
-
root.addEventListener("dragover", onDragOver);
|
|
575
|
-
root.addEventListener("dragend", onDragEnd);
|
|
576
|
-
root.addEventListener("drop", onDrop);
|
|
577
|
-
return () => {
|
|
578
|
-
root.removeEventListener("dragover", onDragOver);
|
|
579
|
-
root.removeEventListener("dragend", onDragEnd);
|
|
580
|
-
root.removeEventListener("drop", onDrop);
|
|
581
|
-
};
|
|
582
|
-
}, []);
|
|
583
|
-
return {
|
|
584
|
-
dragRow,
|
|
585
|
-
dragCol
|
|
586
|
-
};
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
function createPointerMoveHandler(refs, view) {
|
|
590
|
-
return index$1.throttle((e) => {
|
|
591
|
-
if (!(view == null ? void 0 : view.editable))
|
|
592
|
-
return;
|
|
593
|
-
const {
|
|
594
|
-
contentWrapperRef,
|
|
595
|
-
yLineHandleRef,
|
|
596
|
-
xLineHandleRef,
|
|
597
|
-
colHandleRef,
|
|
598
|
-
rowHandleRef,
|
|
599
|
-
hoverIndex,
|
|
600
|
-
lineHoverIndex
|
|
601
|
-
} = refs;
|
|
602
|
-
const yHandle = yLineHandleRef.current;
|
|
603
|
-
if (!yHandle)
|
|
604
|
-
return;
|
|
605
|
-
const xHandle = xLineHandleRef.current;
|
|
606
|
-
if (!xHandle)
|
|
607
|
-
return;
|
|
608
|
-
const content = contentWrapperRef.current;
|
|
609
|
-
if (!content)
|
|
610
|
-
return;
|
|
611
|
-
const rowHandle = rowHandleRef.current;
|
|
612
|
-
if (!rowHandle)
|
|
613
|
-
return;
|
|
614
|
-
const colHandle = colHandleRef.current;
|
|
615
|
-
if (!colHandle)
|
|
616
|
-
return;
|
|
617
|
-
const index = findPointerIndex(e, view);
|
|
618
|
-
if (!index)
|
|
619
|
-
return;
|
|
620
|
-
const dom = getRelatedDOM(contentWrapperRef, index);
|
|
621
|
-
if (!dom)
|
|
622
|
-
return;
|
|
623
|
-
const [rowIndex, colIndex] = index;
|
|
624
|
-
const boundary = dom.col.getBoundingClientRect();
|
|
625
|
-
const closeToBoundaryLeft = Math.abs(e.clientX - boundary.left) < 8;
|
|
626
|
-
const closeToBoundaryRight = Math.abs(boundary.right - e.clientX) < 8;
|
|
627
|
-
const closeToBoundaryTop = Math.abs(e.clientY - boundary.top) < 8;
|
|
628
|
-
const closeToBoundaryBottom = Math.abs(boundary.bottom - e.clientY) < 8;
|
|
629
|
-
const closeToBoundary = closeToBoundaryLeft || closeToBoundaryRight || closeToBoundaryTop || closeToBoundaryBottom;
|
|
630
|
-
const rowButtonGroup = rowHandle.querySelector(".button-group");
|
|
631
|
-
const colButtonGroup = colHandle.querySelector(".button-group");
|
|
632
|
-
if (rowButtonGroup)
|
|
633
|
-
rowButtonGroup.dataset.show = "false";
|
|
634
|
-
if (colButtonGroup)
|
|
635
|
-
colButtonGroup.dataset.show = "false";
|
|
636
|
-
if (closeToBoundary) {
|
|
637
|
-
const contentBoundary = content.getBoundingClientRect();
|
|
638
|
-
rowHandle.dataset.show = "false";
|
|
639
|
-
colHandle.dataset.show = "false";
|
|
640
|
-
xHandle.dataset.displayType = "tool";
|
|
641
|
-
yHandle.dataset.displayType = "tool";
|
|
642
|
-
const yHandleWidth = yHandle.getBoundingClientRect().width;
|
|
643
|
-
const xHandleHeight = xHandle.getBoundingClientRect().height;
|
|
644
|
-
if (closeToBoundaryLeft || closeToBoundaryRight) {
|
|
645
|
-
lineHoverIndex.current[1] = closeToBoundaryLeft ? colIndex : colIndex + 1;
|
|
646
|
-
floatingUi_dom.computePosition(dom.col, yHandle, {
|
|
647
|
-
placement: closeToBoundaryLeft ? "left" : "right",
|
|
648
|
-
middleware: [floatingUi_dom.offset(closeToBoundaryLeft ? -1 * yHandleWidth : 0)]
|
|
649
|
-
}).then(({ x }) => {
|
|
650
|
-
yHandle.dataset.show = "true";
|
|
651
|
-
Object.assign(yHandle.style, {
|
|
652
|
-
height: `${contentBoundary.height}px`,
|
|
653
|
-
left: `${x}px`
|
|
654
|
-
});
|
|
655
|
-
});
|
|
656
|
-
} else {
|
|
657
|
-
yHandle.dataset.show = "false";
|
|
658
|
-
}
|
|
659
|
-
if (index[0] !== 0 && (closeToBoundaryTop || closeToBoundaryBottom)) {
|
|
660
|
-
lineHoverIndex.current[0] = closeToBoundaryTop ? rowIndex : rowIndex + 1;
|
|
661
|
-
floatingUi_dom.computePosition(dom.row, xHandle, {
|
|
662
|
-
placement: closeToBoundaryTop ? "top" : "bottom",
|
|
663
|
-
middleware: [floatingUi_dom.offset(closeToBoundaryTop ? -1 * xHandleHeight : 0)]
|
|
664
|
-
}).then(({ y }) => {
|
|
665
|
-
xHandle.dataset.show = "true";
|
|
666
|
-
Object.assign(xHandle.style, {
|
|
667
|
-
width: `${contentBoundary.width}px`,
|
|
668
|
-
top: `${y}px`
|
|
669
|
-
});
|
|
670
|
-
});
|
|
671
|
-
} else {
|
|
672
|
-
xHandle.dataset.show = "false";
|
|
673
|
-
}
|
|
674
|
-
return;
|
|
675
|
-
}
|
|
676
|
-
lineHoverIndex.current = [-1, -1];
|
|
677
|
-
yHandle.dataset.show = "false";
|
|
678
|
-
xHandle.dataset.show = "false";
|
|
679
|
-
rowHandle.dataset.show = "true";
|
|
680
|
-
colHandle.dataset.show = "true";
|
|
681
|
-
computeRowHandlePositionByIndex({
|
|
682
|
-
refs,
|
|
683
|
-
index
|
|
684
|
-
});
|
|
685
|
-
computeColHandlePositionByIndex({
|
|
686
|
-
refs,
|
|
687
|
-
index
|
|
688
|
-
});
|
|
689
|
-
hoverIndex.current = index;
|
|
690
|
-
}, 20);
|
|
691
|
-
}
|
|
692
|
-
function createPointerLeaveHandler(refs) {
|
|
693
|
-
return () => {
|
|
694
|
-
const {
|
|
695
|
-
rowHandleRef,
|
|
696
|
-
colHandleRef,
|
|
697
|
-
yLineHandleRef,
|
|
698
|
-
xLineHandleRef
|
|
699
|
-
} = refs;
|
|
700
|
-
setTimeout(() => {
|
|
701
|
-
const rowHandle = rowHandleRef.current;
|
|
702
|
-
if (!rowHandle)
|
|
703
|
-
return;
|
|
704
|
-
const colHandle = colHandleRef.current;
|
|
705
|
-
if (!colHandle)
|
|
706
|
-
return;
|
|
707
|
-
const yHandle = yLineHandleRef.current;
|
|
708
|
-
if (!yHandle)
|
|
709
|
-
return;
|
|
710
|
-
const xHandle = xLineHandleRef.current;
|
|
711
|
-
if (!xHandle)
|
|
712
|
-
return;
|
|
713
|
-
rowHandle.dataset.show = "false";
|
|
714
|
-
colHandle.dataset.show = "false";
|
|
715
|
-
yHandle.dataset.show = "false";
|
|
716
|
-
xHandle.dataset.show = "false";
|
|
717
|
-
}, 200);
|
|
718
|
-
};
|
|
719
|
-
}
|
|
720
|
-
function usePointerHandlers(refs, view) {
|
|
721
|
-
const pointerMove = atomico.useMemo(() => createPointerMoveHandler(refs, view), []);
|
|
722
|
-
const pointerLeave = atomico.useMemo(() => createPointerLeaveHandler(refs), []);
|
|
723
|
-
return {
|
|
724
|
-
pointerMove,
|
|
725
|
-
pointerLeave
|
|
726
|
-
};
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
function useOperation(refs, ctx, getPos) {
|
|
730
|
-
const {
|
|
731
|
-
xLineHandleRef,
|
|
732
|
-
contentWrapperRef,
|
|
733
|
-
colHandleRef,
|
|
734
|
-
rowHandleRef,
|
|
735
|
-
hoverIndex,
|
|
736
|
-
lineHoverIndex
|
|
737
|
-
} = refs;
|
|
738
|
-
const onAddRow = atomico.useCallback(() => {
|
|
739
|
-
var _a, _b, _c;
|
|
740
|
-
if (!ctx)
|
|
741
|
-
return;
|
|
742
|
-
const xHandle = xLineHandleRef.current;
|
|
743
|
-
if (!xHandle)
|
|
744
|
-
return;
|
|
745
|
-
const [rowIndex] = lineHoverIndex.current;
|
|
746
|
-
if (rowIndex < 0)
|
|
747
|
-
return;
|
|
748
|
-
if (!ctx.get(index.editorViewCtx).editable)
|
|
749
|
-
return;
|
|
750
|
-
const rows = Array.from((_b = (_a = contentWrapperRef.current) == null ? void 0 : _a.querySelectorAll("tr")) != null ? _b : []);
|
|
751
|
-
const commands = ctx.get(index.commandsCtx);
|
|
752
|
-
const pos = ((_c = getPos == null ? void 0 : getPos()) != null ? _c : 0) + 1;
|
|
753
|
-
if (rows.length === rowIndex) {
|
|
754
|
-
commands.call(index.selectRowCommand.key, { pos, index: rowIndex - 1 });
|
|
755
|
-
commands.call(index.addRowAfterCommand.key);
|
|
756
|
-
} else {
|
|
757
|
-
commands.call(index.selectRowCommand.key, { pos, index: rowIndex });
|
|
758
|
-
commands.call(index.addRowBeforeCommand.key);
|
|
759
|
-
}
|
|
760
|
-
commands.call(index.selectRowCommand.key, { pos, index: rowIndex });
|
|
761
|
-
xHandle.dataset.show = "false";
|
|
762
|
-
}, []);
|
|
763
|
-
const onAddCol = atomico.useCallback(() => {
|
|
764
|
-
var _a, _b, _c, _d;
|
|
765
|
-
if (!ctx)
|
|
766
|
-
return;
|
|
767
|
-
const xHandle = xLineHandleRef.current;
|
|
768
|
-
if (!xHandle)
|
|
769
|
-
return;
|
|
770
|
-
const [_, colIndex] = lineHoverIndex.current;
|
|
771
|
-
if (colIndex < 0)
|
|
772
|
-
return;
|
|
773
|
-
if (!ctx.get(index.editorViewCtx).editable)
|
|
774
|
-
return;
|
|
775
|
-
const cols = Array.from((_c = (_b = (_a = contentWrapperRef.current) == null ? void 0 : _a.querySelector("tr")) == null ? void 0 : _b.children) != null ? _c : []);
|
|
776
|
-
const commands = ctx.get(index.commandsCtx);
|
|
777
|
-
const pos = ((_d = getPos == null ? void 0 : getPos()) != null ? _d : 0) + 1;
|
|
778
|
-
if (cols.length === colIndex) {
|
|
779
|
-
commands.call(index.selectColCommand.key, { pos, index: colIndex - 1 });
|
|
780
|
-
commands.call(index.addColAfterCommand.key);
|
|
781
|
-
} else {
|
|
782
|
-
commands.call(index.selectColCommand.key, { pos, index: colIndex });
|
|
783
|
-
commands.call(index.addColBeforeCommand.key);
|
|
784
|
-
}
|
|
785
|
-
commands.call(index.selectColCommand.key, { pos, index: colIndex });
|
|
786
|
-
}, []);
|
|
787
|
-
const selectCol = atomico.useCallback(() => {
|
|
788
|
-
var _a, _b;
|
|
789
|
-
if (!ctx)
|
|
790
|
-
return;
|
|
791
|
-
const [_, colIndex] = hoverIndex.current;
|
|
792
|
-
const commands = ctx.get(index.commandsCtx);
|
|
793
|
-
const pos = ((_a = getPos == null ? void 0 : getPos()) != null ? _a : 0) + 1;
|
|
794
|
-
commands.call(index.selectColCommand.key, { pos, index: colIndex });
|
|
795
|
-
const buttonGroup = (_b = colHandleRef.current) == null ? void 0 : _b.querySelector(".button-group");
|
|
796
|
-
if (buttonGroup)
|
|
797
|
-
buttonGroup.dataset.show = buttonGroup.dataset.show === "true" ? "false" : "true";
|
|
798
|
-
}, []);
|
|
799
|
-
const selectRow = atomico.useCallback(() => {
|
|
800
|
-
var _a, _b;
|
|
801
|
-
if (!ctx)
|
|
802
|
-
return;
|
|
803
|
-
const [rowIndex, _] = hoverIndex.current;
|
|
804
|
-
const commands = ctx.get(index.commandsCtx);
|
|
805
|
-
const pos = ((_a = getPos == null ? void 0 : getPos()) != null ? _a : 0) + 1;
|
|
806
|
-
commands.call(index.selectRowCommand.key, { pos, index: rowIndex });
|
|
807
|
-
const buttonGroup = (_b = rowHandleRef.current) == null ? void 0 : _b.querySelector(".button-group");
|
|
808
|
-
if (buttonGroup && rowIndex > 0)
|
|
809
|
-
buttonGroup.dataset.show = buttonGroup.dataset.show === "true" ? "false" : "true";
|
|
810
|
-
}, []);
|
|
811
|
-
const deleteSelected = atomico.useCallback((e) => {
|
|
812
|
-
if (!ctx)
|
|
813
|
-
return;
|
|
814
|
-
if (!ctx.get(index.editorViewCtx).editable)
|
|
815
|
-
return;
|
|
816
|
-
e.preventDefault();
|
|
817
|
-
e.stopPropagation();
|
|
818
|
-
const commands = ctx.get(index.commandsCtx);
|
|
819
|
-
commands.call(index.deleteSelectedCellsCommand.key);
|
|
820
|
-
}, []);
|
|
821
|
-
const onAlign = atomico.useCallback((direction) => (e) => {
|
|
822
|
-
if (!ctx)
|
|
823
|
-
return;
|
|
824
|
-
if (!ctx.get(index.editorViewCtx).editable)
|
|
825
|
-
return;
|
|
826
|
-
e.preventDefault();
|
|
827
|
-
e.stopPropagation();
|
|
828
|
-
const commands = ctx.get(index.commandsCtx);
|
|
829
|
-
commands.call(index.setAlignCommand.key, direction);
|
|
830
|
-
}, []);
|
|
831
|
-
return {
|
|
832
|
-
onAddRow,
|
|
833
|
-
onAddCol,
|
|
834
|
-
selectCol,
|
|
835
|
-
selectRow,
|
|
836
|
-
deleteSelected,
|
|
837
|
-
onAlign
|
|
838
|
-
};
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
const tableComponent = ({
|
|
842
|
-
view,
|
|
843
|
-
ctx,
|
|
844
|
-
getPos,
|
|
845
|
-
node,
|
|
846
|
-
config
|
|
847
|
-
}) => {
|
|
848
|
-
const host = atomico.useHost();
|
|
849
|
-
const contentWrapperRef = atomico.useRef();
|
|
850
|
-
const colHandleRef = atomico.useRef();
|
|
851
|
-
const rowHandleRef = atomico.useRef();
|
|
852
|
-
const xLineHandleRef = atomico.useRef();
|
|
853
|
-
const yLineHandleRef = atomico.useRef();
|
|
854
|
-
const tableWrapperRef = atomico.useRef();
|
|
855
|
-
const dragPreviewRef = atomico.useRef();
|
|
856
|
-
const hoverIndex = atomico.useRef([0, 0]);
|
|
857
|
-
const lineHoverIndex = atomico.useRef([-1, -1]);
|
|
858
|
-
const dragInfo = atomico.useRef();
|
|
859
|
-
const refs = atomico.useMemo(() => {
|
|
860
|
-
return {
|
|
861
|
-
dragPreviewRef,
|
|
862
|
-
tableWrapperRef,
|
|
863
|
-
contentWrapperRef,
|
|
864
|
-
yLineHandleRef,
|
|
865
|
-
xLineHandleRef,
|
|
866
|
-
colHandleRef,
|
|
867
|
-
rowHandleRef,
|
|
868
|
-
hoverIndex,
|
|
869
|
-
lineHoverIndex,
|
|
870
|
-
dragInfo
|
|
871
|
-
};
|
|
872
|
-
}, []);
|
|
873
|
-
atomico.useLayoutEffect(() => {
|
|
874
|
-
const current = contentWrapperRef.current;
|
|
875
|
-
if (!current)
|
|
876
|
-
return;
|
|
877
|
-
const contentDOM = host.current.querySelector("[data-content-dom]");
|
|
878
|
-
if (contentDOM)
|
|
879
|
-
current.appendChild(contentDOM);
|
|
880
|
-
if (view == null ? void 0 : view.editable)
|
|
881
|
-
recoveryStateBetweenUpdate(refs, ctx, node);
|
|
882
|
-
}, []);
|
|
883
|
-
const { pointerLeave, pointerMove } = usePointerHandlers(refs, view);
|
|
884
|
-
const { dragRow, dragCol } = useDragHandlers(refs, ctx, getPos);
|
|
885
|
-
const {
|
|
886
|
-
onAddRow,
|
|
887
|
-
onAddCol,
|
|
888
|
-
selectCol,
|
|
889
|
-
selectRow,
|
|
890
|
-
deleteSelected,
|
|
891
|
-
onAlign
|
|
892
|
-
} = useOperation(refs, ctx, getPos);
|
|
893
|
-
return atomico.html`
|
|
894
|
-
<host
|
|
895
|
-
class=${clsx.clsx(!(view == null ? void 0 : view.editable) && "readonly")}
|
|
896
|
-
ondragstart=${(e) => e.preventDefault()}
|
|
897
|
-
ondragover=${(e) => e.preventDefault()}
|
|
898
|
-
ondragleave=${(e) => e.preventDefault()}
|
|
899
|
-
onpointermove=${pointerMove}
|
|
900
|
-
onpointerleave=${pointerLeave}
|
|
901
|
-
>
|
|
902
|
-
<button
|
|
903
|
-
data-show="false"
|
|
904
|
-
contenteditable="false"
|
|
905
|
-
draggable="true"
|
|
906
|
-
data-role="col-drag-handle"
|
|
907
|
-
class="handle cell-handle"
|
|
908
|
-
ondragstart=${dragCol}
|
|
909
|
-
onclick=${selectCol}
|
|
910
|
-
onpointerdown=${(e) => e.stopPropagation()}
|
|
911
|
-
onpointermove=${(e) => e.stopPropagation()}
|
|
912
|
-
ref=${colHandleRef}
|
|
913
|
-
>
|
|
914
|
-
${config == null ? void 0 : config.renderButton("col_drag_handle")}
|
|
915
|
-
<div
|
|
916
|
-
data-show="false"
|
|
917
|
-
class="button-group"
|
|
918
|
-
onpointermove=${(e) => e.stopPropagation}
|
|
919
|
-
>
|
|
920
|
-
<button onpointerdown=${onAlign("left")}>
|
|
921
|
-
${config == null ? void 0 : config.renderButton("align_col_left")}
|
|
922
|
-
</button>
|
|
923
|
-
<button onpointerdown=${onAlign("center")}>
|
|
924
|
-
${config == null ? void 0 : config.renderButton("align_col_center")}
|
|
925
|
-
</button>
|
|
926
|
-
<button onpointerdown=${onAlign("right")}>
|
|
927
|
-
${config == null ? void 0 : config.renderButton("align_col_right")}
|
|
928
|
-
</button>
|
|
929
|
-
<button onpointerdown=${deleteSelected}>
|
|
930
|
-
${config == null ? void 0 : config.renderButton("delete_col")}
|
|
931
|
-
</button>
|
|
932
|
-
</div>
|
|
933
|
-
</button>
|
|
934
|
-
<button
|
|
935
|
-
data-show="false"
|
|
936
|
-
contenteditable="false"
|
|
937
|
-
draggable="true"
|
|
938
|
-
data-role="row-drag-handle"
|
|
939
|
-
class="handle cell-handle"
|
|
940
|
-
ondragstart=${dragRow}
|
|
941
|
-
onclick=${selectRow}
|
|
942
|
-
onpointerdown=${(e) => e.stopPropagation()}
|
|
943
|
-
onpointermove=${(e) => e.stopPropagation()}
|
|
944
|
-
ref=${rowHandleRef}
|
|
945
|
-
>
|
|
946
|
-
${config == null ? void 0 : config.renderButton("row_drag_handle")}
|
|
947
|
-
<div
|
|
948
|
-
data-show="false"
|
|
949
|
-
class="button-group"
|
|
950
|
-
onpointermove=${(e) => e.stopPropagation}
|
|
951
|
-
>
|
|
952
|
-
<button onpointerdown=${deleteSelected}>
|
|
953
|
-
${config == null ? void 0 : config.renderButton("delete_row")}
|
|
954
|
-
</button>
|
|
955
|
-
</div>
|
|
956
|
-
</button>
|
|
957
|
-
<div class="table-wrapper" ref=${tableWrapperRef}>
|
|
958
|
-
<div
|
|
959
|
-
data-show="false"
|
|
960
|
-
class="drag-preview"
|
|
961
|
-
data-direction="vertical"
|
|
962
|
-
ref=${dragPreviewRef}
|
|
963
|
-
>
|
|
964
|
-
<table>
|
|
965
|
-
<tbody>
|
|
966
|
-
</tbody>
|
|
967
|
-
</table>
|
|
968
|
-
</div>
|
|
969
|
-
<div
|
|
970
|
-
data-show="false"
|
|
971
|
-
contenteditable="false"
|
|
972
|
-
data-display-type="tool"
|
|
973
|
-
data-role="x-line-drag-handle"
|
|
974
|
-
class="handle line-handle"
|
|
975
|
-
onpointermove=${(e) => e.stopPropagation}
|
|
976
|
-
ref=${xLineHandleRef}
|
|
977
|
-
>
|
|
978
|
-
<button onclick=${onAddRow} class="add-button">
|
|
979
|
-
${config == null ? void 0 : config.renderButton("add_row")}
|
|
980
|
-
</button>
|
|
981
|
-
</div>
|
|
982
|
-
<div
|
|
983
|
-
data-show="false"
|
|
984
|
-
contenteditable="false"
|
|
985
|
-
data-display-type="tool"
|
|
986
|
-
data-role="y-line-drag-handle"
|
|
987
|
-
class="handle line-handle"
|
|
988
|
-
onpointermove=${(e) => e.stopPropagation}
|
|
989
|
-
ref=${yLineHandleRef}
|
|
990
|
-
>
|
|
991
|
-
<button onclick=${onAddCol} class="add-button">
|
|
992
|
-
${config == null ? void 0 : config.renderButton("add_col")}
|
|
993
|
-
</button>
|
|
994
|
-
</div>
|
|
995
|
-
<table ref=${contentWrapperRef} class="children"></table>
|
|
996
|
-
</div>
|
|
997
|
-
</host>
|
|
998
|
-
`;
|
|
999
|
-
};
|
|
1000
|
-
tableComponent.props = {
|
|
1001
|
-
getPos: Function,
|
|
1002
|
-
view: Object,
|
|
1003
|
-
ctx: Object,
|
|
1004
|
-
node: Object,
|
|
1005
|
-
config: Object
|
|
1006
|
-
};
|
|
1007
|
-
const TableElement = atomico.c(tableComponent);
|
|
1008
|
-
|
|
1009
|
-
var __typeError = (msg) => {
|
|
1010
|
-
throw TypeError(msg);
|
|
1011
|
-
};
|
|
1012
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
1013
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
1014
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
1015
|
-
var _TableNodeView_instances, handleClick_fn;
|
|
1016
|
-
class TableNodeView {
|
|
1017
|
-
constructor(ctx, node, view, getPos) {
|
|
1018
|
-
this.ctx = ctx;
|
|
1019
|
-
this.node = node;
|
|
1020
|
-
this.view = view;
|
|
1021
|
-
this.getPos = getPos;
|
|
1022
|
-
__privateAdd(this, _TableNodeView_instances);
|
|
1023
|
-
const dom = document.createElement("milkdown-table-block");
|
|
1024
|
-
this.dom = dom;
|
|
1025
|
-
dom.view = view;
|
|
1026
|
-
dom.ctx = ctx;
|
|
1027
|
-
dom.getPos = getPos;
|
|
1028
|
-
dom.node = node;
|
|
1029
|
-
dom.config = ctx.get(tableBlockConfig.key);
|
|
1030
|
-
const contentDOM = document.createElement("tbody");
|
|
1031
|
-
this.contentDOM = contentDOM;
|
|
1032
|
-
contentDOM.setAttribute("data-content-dom", "true");
|
|
1033
|
-
contentDOM.classList.add("content-dom");
|
|
1034
|
-
dom.appendChild(contentDOM);
|
|
1035
|
-
}
|
|
1036
|
-
update(node) {
|
|
1037
|
-
if (node.type !== this.node.type)
|
|
1038
|
-
return false;
|
|
1039
|
-
if (node.sameMarkup(this.node) && node.content.eq(this.node.content))
|
|
1040
|
-
return false;
|
|
1041
|
-
this.node = node;
|
|
1042
|
-
this.dom.node = node;
|
|
1043
|
-
return true;
|
|
1044
|
-
}
|
|
1045
|
-
stopEvent(e) {
|
|
1046
|
-
if (e.type === "drop" || e.type.startsWith("drag"))
|
|
1047
|
-
return true;
|
|
1048
|
-
if (e.type === "mousedown") {
|
|
1049
|
-
if (e.target instanceof HTMLButtonElement)
|
|
1050
|
-
return true;
|
|
1051
|
-
const target = e.target;
|
|
1052
|
-
if (target instanceof HTMLElement && (target.closest("th") || target.closest("td"))) {
|
|
1053
|
-
const event = e;
|
|
1054
|
-
return __privateMethod(this, _TableNodeView_instances, handleClick_fn).call(this, event);
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
return false;
|
|
1058
|
-
}
|
|
1059
|
-
ignoreMutation(mutation) {
|
|
1060
|
-
if (!this.dom || !this.contentDOM)
|
|
1061
|
-
return true;
|
|
1062
|
-
if (mutation.type === "selection")
|
|
1063
|
-
return false;
|
|
1064
|
-
if (this.contentDOM === mutation.target && mutation.type === "attributes")
|
|
1065
|
-
return true;
|
|
1066
|
-
if (this.contentDOM.contains(mutation.target))
|
|
1067
|
-
return false;
|
|
1068
|
-
return true;
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
_TableNodeView_instances = new WeakSet();
|
|
1072
|
-
handleClick_fn = function(event) {
|
|
1073
|
-
const view = this.view;
|
|
1074
|
-
if (!view.editable)
|
|
1075
|
-
return false;
|
|
1076
|
-
const { state: state$1, dispatch } = view;
|
|
1077
|
-
const pos = view.posAtCoords({ left: event.clientX, top: event.clientY });
|
|
1078
|
-
if (!pos)
|
|
1079
|
-
return false;
|
|
1080
|
-
const $pos = state$1.doc.resolve(pos.inside);
|
|
1081
|
-
const node = prose.findParent((node2) => node2.type.name === "table_cell" || node2.type.name === "table_header")($pos);
|
|
1082
|
-
if (!node)
|
|
1083
|
-
return false;
|
|
1084
|
-
const { from } = node;
|
|
1085
|
-
const selection = state.NodeSelection.create(state$1.doc, from + 1);
|
|
1086
|
-
if (state$1.selection.eq(selection))
|
|
1087
|
-
return false;
|
|
1088
|
-
if (state$1.selection instanceof tables.CellSelection) {
|
|
1089
|
-
setTimeout(() => {
|
|
1090
|
-
dispatch(state$1.tr.setSelection(selection).scrollIntoView());
|
|
1091
|
-
}, 20);
|
|
1092
|
-
} else {
|
|
1093
|
-
requestAnimationFrame(() => {
|
|
1094
|
-
dispatch(state$1.tr.setSelection(selection).scrollIntoView());
|
|
1095
|
-
});
|
|
1096
|
-
}
|
|
1097
|
-
return true;
|
|
1098
|
-
};
|
|
1099
|
-
helper.defIfNotExists("milkdown-table-block", TableElement);
|
|
1100
|
-
const tableBlockView = $view.$view(index.tableSchema.node, (ctx) => {
|
|
1101
|
-
return (initialNode, view, getPos) => {
|
|
1102
|
-
return new TableNodeView(ctx, initialNode, view, getPos);
|
|
1103
|
-
};
|
|
1104
|
-
});
|
|
1105
|
-
todoList.withMeta(tableBlockView, {
|
|
1106
|
-
displayName: "NodeView<table-block>",
|
|
1107
|
-
group: "TableBlock"
|
|
1108
|
-
});
|
|
1109
|
-
|
|
1110
|
-
const tableBlock = [
|
|
1111
|
-
tableBlockConfig,
|
|
1112
|
-
tableBlockView
|
|
1113
|
-
];
|
|
1114
|
-
|
|
1115
|
-
const defineFeature = (editor, config) => {
|
|
1116
|
-
editor.config((ctx) => {
|
|
1117
|
-
ctx.update(tableBlockConfig.key, (defaultConfig) => ({
|
|
1118
|
-
...defaultConfig,
|
|
1119
|
-
renderButton: (renderType) => {
|
|
1120
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
1121
|
-
switch (renderType) {
|
|
1122
|
-
case "add_row":
|
|
1123
|
-
return (_b = (_a = config == null ? void 0 : config.addRowIcon) == null ? void 0 : _a.call(config)) != null ? _b : todoList.plusIcon;
|
|
1124
|
-
case "add_col":
|
|
1125
|
-
return (_d = (_c = config == null ? void 0 : config.addColIcon) == null ? void 0 : _c.call(config)) != null ? _d : todoList.plusIcon;
|
|
1126
|
-
case "delete_row":
|
|
1127
|
-
return (_f = (_e = config == null ? void 0 : config.deleteRowIcon) == null ? void 0 : _e.call(config)) != null ? _f : todoList.removeIcon;
|
|
1128
|
-
case "delete_col":
|
|
1129
|
-
return (_h = (_g = config == null ? void 0 : config.deleteColIcon) == null ? void 0 : _g.call(config)) != null ? _h : todoList.removeIcon;
|
|
1130
|
-
case "align_col_left":
|
|
1131
|
-
return (_j = (_i = config == null ? void 0 : config.alignLeftIcon) == null ? void 0 : _i.call(config)) != null ? _j : todoList.alignLeftIcon;
|
|
1132
|
-
case "align_col_center":
|
|
1133
|
-
return (_l = (_k = config == null ? void 0 : config.alignCenterIcon) == null ? void 0 : _k.call(config)) != null ? _l : todoList.alignCenterIcon;
|
|
1134
|
-
case "align_col_right":
|
|
1135
|
-
return (_n = (_m = config == null ? void 0 : config.alignRightIcon) == null ? void 0 : _m.call(config)) != null ? _n : todoList.alignRightIcon;
|
|
1136
|
-
case "col_drag_handle":
|
|
1137
|
-
return (_p = (_o = config == null ? void 0 : config.colDragHandleIcon) == null ? void 0 : _o.call(config)) != null ? _p : todoList.dragHandleIcon;
|
|
1138
|
-
case "row_drag_handle":
|
|
1139
|
-
return (_r = (_q = config == null ? void 0 : config.rowDragHandleIcon) == null ? void 0 : _q.call(config)) != null ? _r : todoList.dragHandleIcon;
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
}));
|
|
1143
|
-
}).use(tableBlock);
|
|
1144
|
-
};
|
|
1145
|
-
|
|
1146
|
-
exports.defineFeature = defineFeature;
|
|
1147
|
-
//# sourceMappingURL=index-_GOdKqUK.js.map
|