@tryghost/koenig-lexical 0.3.3 → 0.3.5

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.
@@ -7,7 +7,7 @@ import qj, { createPortal as Fre } from "react-dom";
7
7
  (function() {
8
8
  try {
9
9
  var t = typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, e = new Error().stack;
10
- e && (t._sentryDebugIds = t._sentryDebugIds || {}, t._sentryDebugIds[e] = "fa730195-994a-4484-9a71-ca03656f3c04", t._sentryDebugIdIdentifier = "sentry-dbid-fa730195-994a-4484-9a71-ca03656f3c04");
10
+ e && (t._sentryDebugIds = t._sentryDebugIds || {}, t._sentryDebugIds[e] = "8bf0769a-7347-4ed6-92e4-1a1ca700efd3", t._sentryDebugIdIdentifier = "sentry-dbid-8bf0769a-7347-4ed6-92e4-1a1ca700efd3");
11
11
  } catch {
12
12
  }
13
13
  })();
@@ -42491,12 +42491,6 @@ function rV({ code: t, language: e, updateCode: n, updateLanguage: i, onBlur: r
42491
42491
  L.UNDO_COMMAND,
42492
42492
  () => !0,
42493
42493
  L.COMMAND_PRIORITY_LOW
42494
- ),
42495
- l.registerCommand(
42496
- L.COPY_COMMAND,
42497
- (R) => !0,
42498
- L.COMMAND_PRIORITY_CRITICAL
42499
- // mobiledoc copy plugin uses HIGH and otherwise would intercept the copy
42500
42494
  )
42501
42495
  ), [l]);
42502
42496
  const c = U.useCallback((R) => {
@@ -45306,7 +45300,7 @@ function ftt({ editor: t, containerElem: e, cursorDidExitAtTop: n, isNested: i }
45306
45300
  }
45307
45301
  }
45308
45302
  if (!l._fromNested && document.activeElement !== t.getRootElement())
45309
- return !1;
45303
+ return !0;
45310
45304
  if (!i && r) {
45311
45305
  l.preventDefault();
45312
45306
  const h = L.$getNodeByKey(r), p = L.$createParagraphNode();
@@ -47232,7 +47226,7 @@ function HV({
47232
47226
  /* @__PURE__ */ _.jsx(t5, { label: "Insert image", "data-kg-unsplash-insert-button": !0, onClick: (p) => {
47233
47227
  p.stopPropagation(), f({
47234
47228
  src: o.regular.replace(/&w=1080/, "&w=2000"),
47235
- caption: `<span>Photo by <a href="${r.links.html}">${r.name}</a> on <a href="https://unsplash.com/?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit">Unsplash</a></span>`,
47229
+ caption: `<span>Photo by <a href="${r.links.html}">${r.name}</a> / <a href="https://unsplash.com/?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit">Unsplash</a></span>`,
47236
47230
  height: a,
47237
47231
  width: l,
47238
47232
  alt: s,
@@ -55950,7 +55944,7 @@ const xlt = {
55950
55944
  if (!xet(t))
55951
55945
  return null;
55952
55946
  const e = t.getTextContent();
55953
- return "```" + (t.getLanguage() || "") + (e ? `
55947
+ return "```" + (t.language || "") + (e ? `
55954
55948
  ` + e : "") + "\n```";
55955
55949
  },
55956
55950
  regExp: /^```(\w{1,10})?\s/,
@@ -101449,7 +101443,8 @@ function Oft({
101449
101443
  F.preventDefault(), F.stopPropagation(), c.dispatchCommand(xl, { cardKey: t, focusEditor: !1 });
101450
101444
  }, E = (F) => {
101451
101445
  c.update(() => {
101452
- L.$getNodeByKey(t).setSegment(F);
101446
+ const q = L.$getNodeByKey(t);
101447
+ q.segment = F;
101453
101448
  });
101454
101449
  };
101455
101450
  U.useEffect(() => {
@@ -101592,7 +101587,8 @@ Ee(N3, "kgMenu", {
101592
101587
  Icon: Y5,
101593
101588
  insertCommand: mY,
101594
101589
  matches: ["email", "cta", "email-cta"],
101595
- priority: 8
101590
+ priority: 8,
101591
+ postType: "post"
101596
101592
  });
101597
101593
  function Sft() {
101598
101594
  return new N3();
@@ -101724,7 +101720,8 @@ Ee(P3, "kgMenu", [{
101724
101720
  Icon: G5,
101725
101721
  insertCommand: vY,
101726
101722
  matches: ["email content", "only email"],
101727
- priority: 7
101723
+ priority: 7,
101724
+ postType: "post"
101728
101725
  }]);
101729
101726
  const Tft = (t) => new P3(t);
101730
101727
  function $ft({ onFileChange: t, fileInputRef: e }) {
@@ -102966,12 +102963,6 @@ function Hft({ darkMode: t, html: e, updateHtml: n, onBlur: i }) {
102966
102963
  L.UNDO_COMMAND,
102967
102964
  () => !0,
102968
102965
  L.COMMAND_PRIORITY_LOW
102969
- ),
102970
- r.registerCommand(
102971
- L.COPY_COMMAND,
102972
- () => !0,
102973
- L.COMMAND_PRIORITY_CRITICAL
102974
- // mobiledoc copy plugin uses HIGH and otherwise would intercept the copy
102975
102966
  )
102976
102967
  ), [r]);
102977
102968
  const s = U.useCallback((m) => {
@@ -112518,12 +112509,6 @@ function Edt({
112518
112509
  L.UNDO_COMMAND,
112519
112510
  () => !0,
112520
112511
  L.COMMAND_PRIORITY_LOW
112521
- ),
112522
- p.registerCommand(
112523
- L.COPY_COMMAND,
112524
- () => !0,
112525
- L.COMMAND_PRIORITY_CRITICAL
112526
- // mobiledoc copy plugin uses HIGH and otherwise would intercept the copy
112527
112512
  )
112528
112513
  ), [p]), yy(() => {
112529
112514
  a.current = new Sdt({
@@ -123969,10 +123954,10 @@ function ZJ(t, { query: e, config: n } = {}) {
123969
123954
  e = e == null ? void 0 : e.toLowerCase();
123970
123955
  let r = -1;
123971
123956
  function s(a) {
123972
- var f, h, p, m;
123973
- if (a.isHidden && ((f = a.isHidden) != null && f.call(a, { config: n })))
123957
+ var f, h, p, m, w, x;
123958
+ if (a.isHidden && ((f = a.isHidden) != null && f.call(a, { config: n })) || a.postType && ((h = n == null ? void 0 : n.post) != null && h.displayName) && a.postType !== ((p = n == null ? void 0 : n.post) == null ? void 0 : p.displayName))
123974
123959
  return;
123975
- const l = typeof (a == null ? void 0 : a.matches) == "function" ? (h = a == null ? void 0 : a.matches) == null ? void 0 : h.call(a, e, a.label) : (m = (p = a == null ? void 0 : a.matches) == null ? void 0 : p.find) == null ? void 0 : m.call(p, (w) => w.startsWith(e));
123960
+ const l = typeof (a == null ? void 0 : a.matches) == "function" ? (m = a == null ? void 0 : a.matches) == null ? void 0 : m.call(a, e, a.label) : (x = (w = a == null ? void 0 : a.matches) == null ? void 0 : w.find) == null ? void 0 : x.call(w, (O) => O.startsWith(e));
123976
123961
  if (e && !l)
123977
123962
  return;
123978
123963
  typeof a.insertParams == "function" && (a.insertParams = a.insertParams({ config: n }));
@@ -125821,6 +125806,8 @@ function $kt(t, e) {
125821
125806
  async function zj(t, e) {
125822
125807
  if (!(e instanceof ClipboardEvent))
125823
125808
  return;
125809
+ if (document.activeElement !== t.getRootElement())
125810
+ return !0;
125824
125811
  await wd.copyToClipboard(t, e);
125825
125812
  const n = JSON.parse(e.clipboardData.getData("application/x-lexical-editor")), i = JSON.stringify({
125826
125813
  root: {
@@ -125900,7 +125887,7 @@ const UA = ({ paragraphs: t, allowBr: e }) => {
125900
125887
  Fs.ListNode,
125901
125888
  Fs.ListItemNode,
125902
125889
  ks.LinkNode
125903
- ], nw = Nkt, d2t = "0.3.3";
125890
+ ], nw = Nkt, d2t = "0.3.5";
125904
125891
  export {
125905
125892
  GR as $isAtStartOfDocument,
125906
125893
  YR as $isAtTopOfNode,