@bendyline/squisq-editor-react 2.8.0 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  markdownToTiptap,
3
3
  tiptapToMarkdown
4
- } from "./chunk-K2WJYVS4.js";
4
+ } from "./chunk-TLRB3IQC.js";
5
5
 
6
6
  // src/jsonEditor/JsonEditorContext.tsx
7
7
  import { createContext, useContext, useEffect, useMemo } from "react";
@@ -10,6 +10,8 @@ var RE_BOLD_UNDER = /(?<![\p{L}\p{N}_])__(?![\s_])(.+?)(?<![\s_])__(?![\p{L}\p{N
10
10
  var RE_ITALIC_STAR = /\*(?![\s*])(.+?)(?<![\s*])\*/g;
11
11
  var RE_ITALIC_UNDER = /(?<![\p{L}\p{N}_])_(?![\s_])(.+?)(?<![\s_])_(?![\p{L}\p{N}_])/gu;
12
12
  var RE_STRIKETHROUGH = /~~(.+?)~~/g;
13
+ var RE_LEGACY_BOLD_STAR = /\*\*(?![\s*])(.+?)(?<![\s*])([ \t]+)\*\*(?=$|[^\s*])/g;
14
+ var RE_LEGACY_ITALIC_STAR = /(?<!\*)\*(?![\s*])(.+?)(?<![\s*])([ \t]+)\*(?=$|[^\s*])/g;
13
15
  var ESCAPABLE_MD_CHARS = ["*", "_", "~", "\\"];
14
16
  var RE_MD_ESCAPE = /\\([*_~\\])/g;
15
17
  var RE_INLINE_CODE = /`(.+?)`/g;
@@ -18,12 +20,7 @@ var RE_MENTION = /@\[([^\]]+?)\]\(([a-z][a-z0-9+.-]*)\\?:([^)\s]+)\)/gi;
18
20
  var RE_MENTION_TAG = /<span\b[^>]*?\bdata-mention\b[^>]*?>(?:<[^>]+>)*([^<]*)<\/span>/gi;
19
21
  var RE_ICON_MD = /\{\[([a-zA-Z0-9_:-]+)\]\}/g;
20
22
  var RE_ICON_TAG = /<i\b[^>]*?\bdata-icon="([^"]*)"[^>]*?><\/i>/gi;
21
- var RE_STRONG_TAG = /<strong>(.*?)<\/strong>/g;
22
- var RE_B_TAG = /<b>(.*?)<\/b>/g;
23
- var RE_EM_TAG = /<em>(.*?)<\/em>/g;
24
- var RE_I_TAG = /<i>(.*?)<\/i>/g;
25
- var RE_S_TAG = /<s>(.*?)<\/s>/g;
26
- var RE_DEL_TAG = /<del>(.*?)<\/del>/g;
23
+ var RE_MARK_TAG = /<(strong|b|em|i|s|del)>(.*?)<\/\1>/gs;
27
24
  var RE_CODE_TAG = /<code>(.*?)<\/code>/g;
28
25
  var RE_A_TAG = /<a\b([^>]*)>(.*?)<\/a>/g;
29
26
  var RE_IMG_TAG = /<img\b([^>]*)>/g;
@@ -814,8 +811,10 @@ function inlineToHtml(text) {
814
811
  RE_MD_ESCAPE,
815
812
  (_m, ch) => `\0ESC${ESCAPABLE_MD_CHARS.indexOf(ch)}\0`
816
813
  );
814
+ result = result.replace(RE_LEGACY_BOLD_STAR, "<strong>$1</strong>$2");
817
815
  result = result.replace(RE_BOLD_STAR, "<strong>$1</strong>");
818
816
  result = result.replace(RE_BOLD_UNDER, "<strong>$1</strong>");
817
+ result = result.replace(RE_LEGACY_ITALIC_STAR, "<em>$1</em>$2");
819
818
  result = result.replace(RE_ITALIC_STAR, "<em>$1</em>");
820
819
  result = result.replace(RE_ITALIC_UNDER, "<em>$1</em>");
821
820
  result = result.replace(RE_STRIKETHROUGH, "<s>$1</s>");
@@ -961,17 +960,23 @@ function escapeMarkdownTextNodes(html) {
961
960
  }
962
961
  return out + escapeMarkdownText(html.slice(cursor));
963
962
  }
963
+ function markdownFromMarkTags(html) {
964
+ return html.replace(RE_MARK_TAG, (_match, tag, inner) => {
965
+ const convertedInner = markdownFromMarkTags(inner);
966
+ const leading = convertedInner.match(/^\s*/)?.[0] ?? "";
967
+ const trailing = convertedInner.match(/\s*$/)?.[0] ?? "";
968
+ const content = convertedInner.slice(leading.length, convertedInner.length - trailing.length);
969
+ if (!content) return convertedInner;
970
+ const delimiter = tag === "strong" || tag === "b" ? "**" : tag === "em" || tag === "i" ? "*" : "~~";
971
+ return `${leading}${delimiter}${content}${delimiter}${trailing}`;
972
+ });
973
+ }
964
974
  function htmlToInline(html) {
965
975
  let result = html;
966
976
  result = result.replace(/<br\s*\/?>/gi, " \n");
967
977
  result = escapeMarkdownTextNodes(result);
968
978
  result = result.replace(RE_ICON_TAG, (_m, token) => `{[${token}]}`);
969
- result = result.replace(RE_STRONG_TAG, "**$1**");
970
- result = result.replace(RE_B_TAG, "**$1**");
971
- result = result.replace(RE_EM_TAG, "*$1*");
972
- result = result.replace(RE_I_TAG, "*$1*");
973
- result = result.replace(RE_S_TAG, "~~$1~~");
974
- result = result.replace(RE_DEL_TAG, "~~$1~~");
979
+ result = markdownFromMarkTags(result);
975
980
  result = result.replace(RE_CODE_TAG, "`$1`");
976
981
  result = result.replace(RE_MENTION_TAG, (match, _inner) => {
977
982
  const kind = /data-kind="([^"]*)"/i.exec(match)?.[1] ?? "";
package/dist/index.d.ts CHANGED
@@ -572,7 +572,7 @@ declare function EmojiPicker({ open, onSelect, onClose, anchorRef, className, st
572
572
  * DocumentSettingsDialog
573
573
  *
574
574
  * Modal editor for the frontmatter values that Squisq currently
575
- * understands: document title plus the persisted preview keys
575
+ * understands: document title and cover subtitle plus the persisted preview keys
576
576
  * (`squisq-theme`, `squisq-transform`, `squisq-captions`). Writes back
577
577
  * to the same `setFrontmatterValues` channel that `PreviewControls`
578
578
  * uses, so any change made here is reflected in the play-mode controls
package/dist/index.js CHANGED
@@ -205,15 +205,15 @@ import {
205
205
  usePreviewSettings,
206
206
  useTimelineData,
207
207
  useTreeViewData
208
- } from "./chunk-SUXRSZ4Y.js";
208
+ } from "./chunk-53PXOIMU.js";
209
209
  import "./chunk-V4NBQF5C.js";
210
210
  import {
211
211
  JsonEditor
212
- } from "./chunk-YPRX32GY.js";
212
+ } from "./chunk-SAYCG257.js";
213
213
  import {
214
214
  markdownToTiptap,
215
215
  tiptapToMarkdown
216
- } from "./chunk-K2WJYVS4.js";
216
+ } from "./chunk-TLRB3IQC.js";
217
217
  import {
218
218
  ImageEditor,
219
219
  ImageViewer,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  JsonEditor
3
- } from "../chunk-YPRX32GY.js";
4
- import "../chunk-K2WJYVS4.js";
3
+ } from "../chunk-SAYCG257.js";
4
+ import "../chunk-TLRB3IQC.js";
5
5
  export {
6
6
  JsonEditor
7
7
  };
@@ -5,9 +5,9 @@ import {
5
5
  RawEditor,
6
6
  WysiwygEditor,
7
7
  useEditorContext
8
- } from "../chunk-SUXRSZ4Y.js";
8
+ } from "../chunk-53PXOIMU.js";
9
9
  import "../chunk-V4NBQF5C.js";
10
- import "../chunk-K2WJYVS4.js";
10
+ import "../chunk-TLRB3IQC.js";
11
11
  import "../chunk-V44VP242.js";
12
12
  import "../chunk-V3J5S7X6.js";
13
13
  import "../chunk-GS7QWYFT.js";
@@ -9820,6 +9820,71 @@
9820
9820
  color: #6b7280;
9821
9821
  font: 500 14px/1.4 var(--squisq-ux-font, sans-serif);
9822
9822
  }
9823
+ .squisq-print-preview--flashcards {
9824
+ display: grid;
9825
+ gap: 24px;
9826
+ color: var(--squisq-print-flashcard-text);
9827
+ }
9828
+ .squisq-print-flashcard-sheet {
9829
+ width: min(1100px, 100%);
9830
+ aspect-ratio: 11 / 8.5;
9831
+ margin-inline: auto;
9832
+ padding: 4%;
9833
+ background: var(--squisq-print-flashcard-bg);
9834
+ box-shadow: 0 8px 30px rgb(15 23 42 / 18%);
9835
+ break-after: page;
9836
+ }
9837
+ .squisq-print-flashcard-sheet > header {
9838
+ display: flex;
9839
+ justify-content: space-between;
9840
+ margin-bottom: 2%;
9841
+ color: var(--squisq-print-flashcard-muted);
9842
+ font-size: 12px;
9843
+ }
9844
+ .squisq-print-flashcard-pair {
9845
+ display: grid;
9846
+ grid-template-columns: 1fr 1fr;
9847
+ gap: 3%;
9848
+ height: 88%;
9849
+ }
9850
+ .squisq-print-flashcard-face {
9851
+ overflow: hidden;
9852
+ border: 1px solid color-mix(in srgb, var(--squisq-print-flashcard-text) 18%, transparent);
9853
+ border-radius: 16px;
9854
+ padding: 7%;
9855
+ background: var(--squisq-print-flashcard-surface);
9856
+ }
9857
+ .squisq-print-flashcard-face > small,
9858
+ .squisq-print-flashcard-explanation > small {
9859
+ display: block;
9860
+ margin-bottom: 12px;
9861
+ color: var(--squisq-print-flashcard-accent);
9862
+ font-weight: 800;
9863
+ letter-spacing: 0.12em;
9864
+ text-transform: uppercase;
9865
+ }
9866
+ .squisq-print-flashcard-face .squisq-flashcards__content-title {
9867
+ margin: 0 0 0.5em;
9868
+ font-size: clamp(20px, 2.4vw, 34px);
9869
+ }
9870
+ .squisq-print-flashcard-face .squisq-md {
9871
+ font-size: clamp(13px, 1.4vw, 18px);
9872
+ line-height: 1.45;
9873
+ }
9874
+ .squisq-print-flashcard-choices {
9875
+ display: grid;
9876
+ gap: 8px;
9877
+ margin: 18px 0 0;
9878
+ padding-left: 24px;
9879
+ }
9880
+ .squisq-print-flashcard-choices .squisq-flashcards__content-title {
9881
+ font-size: 16px;
9882
+ }
9883
+ .squisq-print-flashcard-explanation {
9884
+ margin-top: 20px;
9885
+ border-top: 1px solid color-mix(in srgb, var(--squisq-print-flashcard-text) 16%, transparent);
9886
+ padding-top: 16px;
9887
+ }
9823
9888
  @container squisq-toolbar (max-width: 820px) {
9824
9889
  .squisq-print-trigger > span,
9825
9890
  .squisq-print-toolbar-title,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/squisq-editor-react",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "React editor shell with raw/WYSIWYG/preview modes for Squisq documents",
5
5
  "license": "MIT",
6
6
  "author": "Bendyline",
@@ -84,10 +84,10 @@
84
84
  "react-dom": "^18.0.0 || ^19.0.0"
85
85
  },
86
86
  "dependencies": {
87
- "@bendyline/squisq": "2.8.0",
88
- "@bendyline/squisq-formats": "2.4.5",
89
- "@bendyline/squisq-react": "2.8.0",
90
- "@bendyline/squisq-video-react": "2.4.0",
87
+ "@bendyline/squisq": "2.9.0",
88
+ "@bendyline/squisq-formats": "2.4.6",
89
+ "@bendyline/squisq-react": "2.9.0",
90
+ "@bendyline/squisq-video-react": "2.4.1",
91
91
  "@fortawesome/fontawesome-free": "7.2.0",
92
92
  "@tiptap/core": "2.27.2",
93
93
  "@tiptap/extension-heading": "2.27.2",