@ylzcc/editor 0.2.17 → 0.2.18

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/README.md CHANGED
@@ -24,4 +24,3 @@
24
24
  1. 组件测试直接在app里面测试使用,所有暴露的组件通过index.t进行暴露,这个也是打包的入口
25
25
 
26
26
 
27
-
package/dist/editor.es.js CHANGED
@@ -84120,8 +84120,9 @@ const setAlign = (Ff) => {
84120
84120
  }
84121
84121
  })), eme([...bme]);
84122
84122
  }, Eme = (bme) => {
84123
- var Rme, xme;
84124
- $P.current = !0, ame(bme == null ? void 0 : bme.id), console.log("🚀 v:", bme, kh), (xme = kh == null ? void 0 : kh.chain()) == null || xme.focus((bme == null ? void 0 : bme.from) + ((Rme = bme == null ? void 0 : bme.text) == null ? void 0 : Rme.length)).run();
84123
+ $P.current = !0, ame(bme == null ? void 0 : bme.id);
84124
+ const Rme = document.getElementById(bme.id);
84125
+ Rme == null || Rme.scrollIntoView({ behavior: "smooth", block: "start", inline: "nearest" });
84125
84126
  }, Sme = () => {
84126
84127
  var Pme, Lme, Dme, yme, kme;
84127
84128
  const bme = (Lme = (Pme = kh == null ? void 0 : kh.view) == null ? void 0 : Pme.docView) == null ? void 0 : Lme.children;
@@ -86710,24 +86711,32 @@ const FloatingMenu = Extension.create({
86710
86711
  var kh, x_;
86711
86712
  const Ff = this;
86712
86713
  (x_ = (kh = navigator == null ? void 0 : navigator.clipboard) == null ? void 0 : kh.read()) == null || x_.then(async (B_) => {
86713
- var $_;
86714
- for (const $P of B_)
86715
- if (($_ = $P == null ? void 0 : $P.types) != null && $_.includes("text/html")) {
86716
- const zP = await ($P == null ? void 0 : $P.getType("text/html")), eme = new FileReader();
86717
- eme.onloadend = async () => {
86718
- var nme;
86719
- if (!eme.result.startsWith("<img")) {
86720
- for (const rme of $P == null ? void 0 : $P.types)
86721
- if (rme != null && rme.includes("image")) {
86722
- const ime = await $P.getType(rme), ome = (/* @__PURE__ */ new Date()).getTime(), ame = new File([ime], ome.toString().substring(0, 4)), cme = new FormData();
86723
- cme.append("file", ame), upload({ url: (nme = Ff.options) == null ? void 0 : nme.oss, file: cme, ext: "png" }).then((ume) => {
86724
- if (ume != null && ume.url)
86725
- return Ff.editor.commands.setImage({ src: ume == null ? void 0 : ume.url });
86714
+ var $_, $P;
86715
+ for (const zP of B_)
86716
+ if (($_ = zP == null ? void 0 : zP.types) != null && $_.includes("text/html")) {
86717
+ const eme = await (zP == null ? void 0 : zP.getType("text/html")), tme = new FileReader();
86718
+ tme.onloadend = async () => {
86719
+ var rme;
86720
+ if (!tme.result.startsWith("<img")) {
86721
+ for (const ime of zP == null ? void 0 : zP.types)
86722
+ if (ime != null && ime.includes("image")) {
86723
+ const ome = await zP.getType(ime), ame = (/* @__PURE__ */ new Date()).getTime(), cme = new File([ome], ame.toString().substring(0, 4)), ume = new FormData();
86724
+ ume.append("file", cme), upload({ url: (rme = Ff.options) == null ? void 0 : rme.oss, file: ume, ext: "png" }).then((sme) => {
86725
+ if (sme != null && sme.url)
86726
+ return Ff.editor.commands.setImage({ src: sme == null ? void 0 : sme.url });
86726
86727
  });
86727
86728
  }
86728
86729
  }
86729
- }, eme.readAsText(zP);
86730
- }
86730
+ }, tme.readAsText(eme);
86731
+ } else
86732
+ for (const eme of zP == null ? void 0 : zP.types)
86733
+ if (eme != null && eme.includes("image")) {
86734
+ const tme = await zP.getType(eme), nme = (/* @__PURE__ */ new Date()).getTime(), rme = new File([tme], nme.toString().substring(0, 4)), ime = new FormData();
86735
+ ime.append("file", rme), upload({ url: ($P = Ff.options) == null ? void 0 : $P.oss, file: ime, ext: "png" }).then((ome) => {
86736
+ if (ome != null && ome.url)
86737
+ return Ff.editor.commands.setImage({ src: ome == null ? void 0 : ome.url });
86738
+ });
86739
+ }
86731
86740
  }).catch((B_) => {
86732
86741
  console.error("获取剪切板内容失败:", B_);
86733
86742
  });
@@ -94521,9 +94530,31 @@ const LinkComponent = (Ff) => {
94521
94530
  };
94522
94531
  },
94523
94532
  addProseMirrorPlugins() {
94524
- var Ff;
94533
+ var kh;
94534
+ const { editor: Ff } = this;
94525
94535
  return [
94526
- ...((Ff = this.parent) == null ? void 0 : Ff.call(this)) || []
94536
+ ...((kh = this.parent) == null ? void 0 : kh.call(this)) || [],
94537
+ new Plugin({
94538
+ key: new PluginKey("tablefocus"),
94539
+ props: {
94540
+ decorations(x_) {
94541
+ if (!Ff.isFocused)
94542
+ return null;
94543
+ const { selection: B_, doc: $_ } = x_, { $anchor: $P, anchor: zP } = B_, eme = [];
94544
+ return $_.descendants((tme, nme) => {
94545
+ const rme = zP >= nme && zP < nme + tme.nodeSize;
94546
+ if (tme.type.name === "active" && rme) {
94547
+ const ime = Decoration.node(nme, nme + tme.nodeSize, {
94548
+ // class: 'tiptap-active-focus',
94549
+ style: "outline: 2px solid #1677ff;"
94550
+ });
94551
+ eme.push(ime);
94552
+ }
94553
+ return !1;
94554
+ }), console.log(eme), DecorationSet.create($_, eme);
94555
+ }
94556
+ }
94557
+ })
94527
94558
  ];
94528
94559
  }
94529
94560
  }), error = "data:image/svg+xml,%3csvg%20width='13'%20height='13'%20viewBox='0%200%2013%2013'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20opacity='0.01'%20x='0.947266'%20y='0.474609'%20width='12'%20height='12'%20fill='black'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M6.94727%201.22461C4.04805%201.22461%201.69727%203.57539%201.69727%206.47461C1.69727%209.37383%204.04805%2011.7246%206.94727%2011.7246C9.84648%2011.7246%2012.1973%209.37383%2012.1973%206.47461C12.1973%203.57539%209.84648%201.22461%206.94727%201.22461Z'%20fill='%23F5222D'/%3e%3cpath%20d='M4.85271%203.95703L4.43977%204.3045C5.175%204.85341%205.85988%205.48289%206.46166%206.11237C5.5401%207.04148%204.81746%207.95548%204.43726%208.3231L5.22285%208.98027C5.50233%208.40367%206.10915%207.52995%206.92244%206.61343C7.73572%207.53499%208.34506%208.41374%208.62455%208.99286C8.62455%208.99286%209.38999%208.17957%209.45798%208.30547C9.16338%207.97311%208.44326%207.00623%207.47638%206.01669C8.03032%205.44764%208.65225%204.88362%209.31698%204.38759L9.13569%204.05019C8.38283%204.42536%207.66522%204.98182%207.02064%205.57353C6.37101%204.95664%205.63578%204.36997%204.85271%203.95703V3.95703Z'%20fill='white'/%3e%3c/svg%3e", Icon_Warning = "data:image/svg+xml,%3csvg%20width='17'%20height='17'%20viewBox='0%200%2017%2017'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20opacity='0.01'%20x='0.164062'%20y='0.354492'%20width='16'%20height='16'%20fill='black'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.16406%201.35449C4.29844%201.35449%201.16406%204.48887%201.16406%208.35449C1.16406%2012.2201%204.29844%2015.3545%208.16406%2015.3545C12.0297%2015.3545%2015.1641%2012.2201%2015.1641%208.35449C15.1641%204.48887%2012.0297%201.35449%208.16406%201.35449ZM7.66406%204.97949C7.66406%204.91074%207.72031%204.85449%207.78906%204.85449H8.53906C8.60781%204.85449%208.66406%204.91074%208.66406%204.97949V9.22949C8.66406%209.29824%208.60781%209.35449%208.53906%209.35449H7.78906C7.72031%209.35449%207.66406%209.29824%207.66406%209.22949V4.97949ZM8.16406%2011.8545C7.75%2011.8545%207.41406%2011.5186%207.41406%2011.1045C7.41406%2010.6904%207.75%2010.3545%208.16406%2010.3545C8.57813%2010.3545%208.91406%2010.6904%208.91406%2011.1045C8.91406%2011.5186%208.57813%2011.8545%208.16406%2011.8545Z'%20fill='%23FAAD14'/%3e%3c/svg%3e", arrowIcon = "data:image/svg+xml,%3csvg%20width='17'%20height='16'%20viewBox='0%200%2017%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20opacity='0.01'%20x='16.5352'%20y='16'%20width='16'%20height='16'%20transform='rotate(-180%2016.5352%2016)'%20fill='black'/%3e%3cpath%20d='M4.75455%2010.7326L8.71709%206.43956L12.68%2010.7326C12.8843%2010.9541%2013.2295%2010.9679%2013.4509%2010.7636C13.6723%2010.5592%2013.6862%2010.2141%2013.4818%209.99265L9.11818%205.26537C9.01492%205.15344%208.86956%205.08977%208.71727%205.08977C8.56498%205.08977%208.41963%205.15344%208.31636%205.26537L3.95273%209.99265C3.74838%2010.2141%203.76222%2010.5592%203.98364%2010.7636C4.20505%2010.9679%204.5502%2010.9541%204.75455%2010.7326'%20fill='%23FAAD14'/%3e%3c/svg%3e", tipIcon = "data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_954_6949)'%3e%3cg%20filter='url(%23filter0_i_954_6949)'%3e%3cpath%20d='M26.9806%2012.2299L29.1814%2011.1896C29.9321%2013.1617%2030.1883%2015.2877%2029.9274%2017.3817C29.6665%2019.4757%2028.8965%2021.4739%2027.6848%2023.2015L25.6975%2021.81C26.6636%2020.4329%2027.2845%2018.8438%2027.5078%2017.1765C27.7311%2015.5092%2027.5503%2013.8127%2026.9806%2012.2299ZM17.053%205.27772C15.3709%205.28347%2013.7147%205.69355%2012.2243%206.47339C10.7338%207.25323%209.45264%208.37997%208.48881%209.75864L6.50399%208.36886C7.71308%206.63945%209.32747%205.23262%2011.206%204.27141C13.0845%203.31019%2015.1699%202.82387%2017.2798%202.85497L17.0554%205.2795L17.053%205.27772ZM12.325%2028.2294C12.0815%2028.5771%2011.772%2028.8734%2011.414%2029.1015C11.056%2029.3295%2010.6566%2029.4848%2010.2386%2029.5586C9.82061%2029.6323%209.39218%2029.6229%208.97778%2029.531C8.56339%2029.4392%208.17115%2029.2666%207.82346%2029.0231C7.47577%2028.7796%207.17943%2028.4701%206.95138%2028.1121C6.72332%2027.7541%206.56801%2027.3547%206.49431%2026.9367C6.34546%2026.0925%206.53806%2025.2237%207.02975%2024.5216L12.325%2028.2294ZM23.7127%2020.4202L20.9314%2024.3923L20.2555%2028.9549C20.2148%2029.2272%2020.1052%2029.4845%2019.9371%2029.7026C19.769%2029.9206%2019.548%2030.0921%2019.295%2030.2008C19.042%2030.3094%2018.7655%2030.3516%2018.4916%2030.3234C18.2178%2030.2952%2017.9556%2030.1974%2017.7301%2030.0395L3.48051%2020.0642C3.25433%2019.9064%203.07227%2019.6935%202.95167%2019.4455C2.83107%2019.1975%202.77592%2018.9228%202.79149%2018.6475C2.80706%2018.3721%202.89282%2018.1054%203.04062%2017.8726C3.18841%2017.6398%203.39332%2017.4487%203.63584%2017.3174L7.69207%2015.1218L10.4747%2011.15C11.3766%209.86202%2012.6346%208.8651%2014.0946%208.28134C15.5545%207.69757%2017.153%207.55231%2018.6943%207.86334L19.0811%207.31281C19.3203%206.95534%2019.6285%206.64922%2019.9876%206.41239C20.3467%206.17556%2020.7494%206.01279%2021.1722%205.93362C21.595%205.85444%2022.0293%205.86046%2022.4498%205.95132C22.8702%206.04217%2023.2683%206.21604%2023.6206%206.46273C23.973%206.70941%2024.2726%207.02396%2024.5018%207.38792C24.7311%207.75188%2024.8854%208.15794%2024.9557%208.5823C25.0259%209.00666%2025.0108%209.44078%2024.9111%209.85922C24.8115%2010.2777%2024.6293%2010.672%2024.3753%2011.0191L23.9911%2011.5701C24.811%2012.9126%2025.2214%2014.4651%2025.1719%2016.0374C25.1224%2017.6096%2024.6152%2019.1333%2023.7125%2020.4215L23.7127%2020.4202Z'%20fill='%23FFCC33'%20fill-opacity='0.15'/%3e%3c/g%3e%3cpath%20d='M21.3721%2019.6161C22.2185%2018.4077%2022.6941%2016.9787%2022.7405%2015.5041C22.787%2014.0291%2022.402%2012.5726%2021.6328%2011.3131L21.4625%2011.0344L21.6493%2010.7665L22.0335%2010.2156L22.04%2010.2062L22.0401%2010.2062C22.2549%209.91283%2022.4089%209.5795%2022.4931%209.2258C22.5774%208.87209%2022.5901%208.50513%2022.5307%208.14642C22.4713%207.78771%2022.3409%207.44447%2022.1471%207.13681C21.9534%206.82916%2021.7001%206.56327%2021.4023%206.35475C21.1044%206.14623%2020.7679%205.99926%2020.4125%205.92246C20.0571%205.84566%2019.69%205.84057%2019.3326%205.9075C18.9752%205.97442%2018.6348%206.11201%2018.3313%206.3122C18.0277%206.51239%2017.7672%206.77116%2017.565%207.07333L17.5587%207.08276L17.5586%207.08268L17.1718%207.63321L16.984%207.9005L16.6638%207.83588C15.2178%207.54409%2013.7182%207.68037%2012.3486%208.22802C10.9789%208.77567%209.79875%209.71092%208.95263%2010.9192L8.95257%2010.9193L6.16993%2014.8911L6.10222%2014.9877L5.99845%2015.0439L1.94222%2017.2396L1.94216%2017.2396C1.77467%2017.3302%201.63316%2017.4622%201.5311%2017.623C1.42903%2017.7838%201.36981%2017.968%201.35905%2018.1581C1.3483%2018.3482%201.38638%2018.538%201.46967%2018.7092C1.55296%2018.8805%201.67869%2019.0276%201.83489%2019.1365L1.83562%2019.137L16.0852%2029.1123L16.0854%2029.1124C16.2411%2029.2215%2016.4221%2029.289%2016.6112%2029.3084C16.8004%2029.3279%2016.9913%2029.2988%2017.166%2029.2238C17.3407%2029.1487%2017.4934%2029.0303%2017.6095%2028.8797C17.7254%2028.7293%2017.8011%2028.5518%2017.8293%2028.364L21.3721%2019.6161ZM21.3721%2019.6161L21.3715%2019.6158L18.5902%2023.5879L18.5225%2023.6846L18.5052%2023.8014L17.8294%2028.3634L21.3721%2019.6161ZM14.7994%202.84116L14.6671%204.27101C13.0611%204.34269%2011.4885%204.76584%2010.0608%205.51279C8.64735%206.25234%207.41357%207.28968%206.44341%208.55102L5.27665%207.73406C6.40133%206.25582%207.84479%205.04697%209.50211%204.19894C11.147%203.35725%2012.957%202.89436%2014.7994%202.84116ZM26.0717%2016.7253C26.2855%2015.1291%2026.1457%2013.5074%2025.6647%2011.9743L26.964%2011.3601C27.5441%2013.1097%2027.728%2014.9688%2027.4996%2016.8023C27.2694%2018.6498%2026.627%2020.4196%2025.6224%2021.982L24.4533%2021.1634C25.3069%2019.8204%2025.86%2018.3064%2026.0717%2016.7253ZM5.05507%2026.3323C4.95858%2025.7851%205.03183%2025.2256%205.25868%2024.7268L9.6592%2027.8081C9.52376%2027.941%209.37452%2028.0598%209.21372%2028.1622C8.91111%2028.355%208.5735%2028.4863%208.22015%2028.5486C7.86681%2028.6109%207.50466%2028.603%207.15437%2028.5253C6.80408%2028.4476%206.47252%2028.3017%206.17861%2028.096C5.88471%2027.8902%205.63421%2027.6285%205.44143%2027.3259C5.24866%2027.0233%205.11737%2026.6857%205.05507%2026.3323Z'%20stroke='%23FAA600'%20stroke-opacity='0.4'/%3e%3c/g%3e%3cdefs%3e%3cfilter%20id='filter0_i_954_6949'%20x='2.78906'%20y='2.85352'%20width='27.2373'%20height='27.4785'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset%20dx='-2'%20dy='2'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200.96%200%200%200%200%200.832%200%200%200%200%200.576%200%200%200%200.3%200'/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_954_6949'/%3e%3c/filter%3e%3cclipPath%20id='clip0_954_6949'%3e%3crect%20width='32'%20height='32'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e", questionSuccess = "data:image/svg+xml,%3csvg%20width='13'%20height='13'%20viewBox='0%200%2013%2013'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20opacity='0.01'%20x='0.947388'%20y='0.474609'%20width='12'%20height='12'%20fill='black'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M6.94739%201.22461C4.04817%201.22461%201.69739%203.57539%201.69739%206.47461C1.69739%209.37383%204.04817%2011.7246%206.94739%2011.7246C9.84661%2011.7246%2012.1974%209.37383%2012.1974%206.47461C12.1974%203.57539%209.84661%201.22461%206.94739%201.22461Z'%20fill='%2330C213'/%3e%3cpath%20d='M3.76379%207.04927C3.76379%207.04927%205.40937%208.39168%205.57283%209.53336C5.57283%209.53336%207.73061%206.01074%2010.1281%205.69556C10.1281%205.69556%209.39799%205.1649%209.63774%204.32617C9.63774%204.32617%208.3082%204.45848%205.80169%208.33841L4.62696%206.34977L3.76379%207.04927Z'%20fill='white'/%3e%3c/svg%3e", selectIcon = "data:image/svg+xml,%3csvg%20width='17'%20height='17'%20viewBox='0%200%2017%2017'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='1.0083'%20y='0.958008'%20width='15'%20height='15'%20rx='1.5'%20fill='%231677FF'%20stroke='%231677FF'/%3e%3cpath%20d='M3.0083%209.08935C3.0083%209.08935%205.85249%2011.4095%206.135%2013.3828C6.135%2013.3828%209.86446%207.29439%2014.0083%206.74964C14.0083%206.74964%2012.7463%205.83246%2013.1607%204.38281C13.1607%204.38281%2010.8627%204.61148%206.53056%2011.3175L4.50018%207.88036L3.0083%209.08935Z'%20fill='white'/%3e%3c/svg%3e", arrowIconBlue = "data:image/svg+xml,%3csvg%20width='16'%20height='17'%20viewBox='0%200%2016%2017'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20opacity='0.01'%20x='16'%20y='16.5566'%20width='16'%20height='16'%20transform='rotate(-180%2016%2016.5566)'%20fill='black'/%3e%3cpath%20d='M4.21939%2011.2893L8.18194%206.9962L12.1448%2011.2893C12.3492%2011.5107%2012.6943%2011.5245%2012.9158%2011.3202C13.1372%2011.1159%2013.151%2010.7707%2012.9467%2010.5493L8.58303%205.82201C8.47976%205.71008%208.33441%205.64642%208.18212%205.64642C8.02983%205.64642%207.88447%205.71008%207.78121%205.82201L3.41757%2010.5493C3.21323%2010.7707%203.22706%2011.1159%203.44848%2011.3202C3.6699%2011.5245%204.01504%2011.5107%204.21939%2011.2893'%20fill='%231677FF'/%3e%3c/svg%3e", isJsonString = (Ff) => {
@@ -139873,6 +139904,26 @@ const deleteTableWhenAllCellsSelected = ({ editor: Ff }) => {
139873
139904
  }
139874
139905
  ];
139875
139906
  }
139907
+ // addProseMirrorPlugins() {
139908
+ // const { editor } = this
139909
+ // return [
139910
+ // new Plugin({
139911
+ // key: new PluginKey('tablefocus'),
139912
+ // view: (view) => {
139913
+ // return {
139914
+ // update(view, prevState) {
139915
+ // if (!editor.isFocused) return
139916
+ // const { state } = view
139917
+ // const { selection } = state
139918
+ // const { $anchor, anchor } = selection
139919
+ // console.log(view)
139920
+ // console.log($anchor, anchor)
139921
+ // },
139922
+ // }
139923
+ // },
139924
+ // })
139925
+ // ]
139926
+ // },
139876
139927
  }), { BubbleMenu, BubbleMenuView } = bubbleModules, shareData = createContext({});
139877
139928
  let Editor = (Ff, kh) => {
139878
139929
  const {
@@ -140114,6 +140165,7 @@ let Editor = (Ff, kh) => {
140114
140165
  }, [tme]), useEffect(() => (window.addEventListener("click", $me), () => {
140115
140166
  window.removeEventListener("click", $me);
140116
140167
  }), [fme]), useImperativeHandle(kh, () => ({
140168
+ editor: fme,
140117
140169
  update: () => {
140118
140170
  const Bme = setTimeout(() => {
140119
140171
  var Ume;