@bagelink/vue 1.20.68 → 1.20.70

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.20.68",
4
+ "version": "1.20.70",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
@@ -63,7 +63,7 @@
63
63
  "@types/signature_pad": "^4.0.0",
64
64
  "vue": "^3.5.43",
65
65
  "vue-component-type-helpers": "^2.2.12",
66
- "@bagelink/sdk": "1.20.68"
66
+ "@bagelink/sdk": "1.20.70"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "@bagelink/sdk": "*",
@@ -79,6 +79,13 @@ const props = withDefaults(defineProps<{
79
79
  maxWords?: number
80
80
  // Field-specific CSS injected into the editor iframe.
81
81
  contentStyles?: string
82
+ /**
83
+ * Render the text column as a page sheet on a muted canvas, so the
84
+ * document width reads as a boundary instead of a floating max-width.
85
+ * `true` uses the default sheet width (680px, matching the PDF placer);
86
+ * a number sets the width in px.
87
+ */
88
+ page?: boolean | number
82
89
  // Optional image uploader. Must resolve to a persistent path key or URL.
83
90
  uploadImage?: (file: File) => Promise<string>
84
91
  /**
@@ -92,8 +99,59 @@ const props = withDefaults(defineProps<{
92
99
  // Boolean props default to `false` at runtime when absent, so the opt-out
93
100
  // needs an explicit default to keep formatting on by default.
94
101
  splitViewFormat: true,
102
+ page: false,
95
103
  })
96
104
 
105
+ // Default sheet width — the same cap the PDF field placer renders a page at.
106
+ const DEFAULT_PAGE_WIDTH = 680
107
+
108
+ const pageWidth = computed(() => {
109
+ if (props.page === true) { return DEFAULT_PAGE_WIDTH }
110
+ if (typeof props.page === 'number' && props.page > 0) { return props.page }
111
+ return 0
112
+ })
113
+
114
+ // The sheet lives inside the iframe, which can't see app utility classes.
115
+ // `reset` restores the plain column so turning the prop off wins over the
116
+ // rules baked into the initial document.
117
+ function pageSheetCss(reset = false): string {
118
+ const width = pageWidth.value
119
+ if (!width) {
120
+ if (!reset) { return '' }
121
+ return `
122
+ html { background: transparent; }
123
+ body {
124
+ box-sizing: border-box;
125
+ max-width: 860px;
126
+ margin: 0 auto;
127
+ padding: 14px 8px 8px 8px;
128
+ background: transparent;
129
+ min-height: 200px;
130
+ box-shadow: none;
131
+ }
132
+ `
133
+ }
134
+ return `
135
+ html { background: color-mix(in srgb, currentColor 5%, transparent); }
136
+ body {
137
+ box-sizing: border-box;
138
+ max-width: ${width}px;
139
+ margin: 1.25rem auto;
140
+ padding: 2.75rem 3rem 4rem;
141
+ background: #fff;
142
+ min-height: calc(100vh - 2.5rem);
143
+ box-shadow: 0 1px 5px rgba(0, 0, 0, .1), 0 1px 2px -1px rgba(0, 0, 0, .1);
144
+ }
145
+ @media (max-width: 760px) {
146
+ body {
147
+ max-width: none;
148
+ margin: 0.5rem auto;
149
+ padding: 1.5rem 1rem 2.5rem;
150
+ }
151
+ }
152
+ `
153
+ }
154
+
97
155
  const emit = defineEmits(['update:modelValue', 'limit-exceeded'])
98
156
 
99
157
  const { shellClass, shellStyle } = useBagelInputShell(props)
@@ -2990,6 +3048,7 @@ async function initEditor() {
2990
3048
  margin: 0 auto;
2991
3049
  unicode-bidi: plaintext;
2992
3050
  }
3051
+ ${pageSheetCss()}
2993
3052
 
2994
3053
  p, h1, h2, h3, h4, h5, h6, blockquote, li {
2995
3054
  unicode-bidi: plaintext;
@@ -3684,6 +3743,7 @@ function updateIframeColors() {
3684
3743
  font-size: ${fontSize} !important;
3685
3744
  font-family: ${currentFontFamily.value} !important;
3686
3745
  }
3746
+ ${pageSheetCss(true)}
3687
3747
 
3688
3748
  /* Body copy inherits the configured base size; headings keep semantic sizes. */
3689
3749
  p, div, li {
@@ -3699,7 +3759,7 @@ function updateIframeColors() {
3699
3759
  }
3700
3760
 
3701
3761
  // Watch for theme changes and update iframe colors
3702
- watch([currentInputColor, currentTextColor, currentFontFamily, effectiveContentStyles], () => {
3762
+ watch([currentInputColor, currentTextColor, currentFontFamily, effectiveContentStyles, pageWidth], () => {
3703
3763
  if (hasInitialized.value) {
3704
3764
  updateIframeColors()
3705
3765
  }
@@ -3837,6 +3897,7 @@ const imgTransform = computed({
3837
3897
  'rich-text-editor--basic': basic,
3838
3898
  'fullscreen-mode': editor.state.isFullscreen,
3839
3899
  'full-height': fullHeight && !editor.state.isFullscreen,
3900
+ 'rich-text-page': pageWidth && !editor.state.isFullscreen,
3840
3901
  },
3841
3902
  ]"
3842
3903
  >
@@ -4556,6 +4617,18 @@ min-height: 0;
4556
4617
  overflow-y: auto;
4557
4618
  }
4558
4619
 
4620
+ /* Page mode: the iframe shows a white sheet on a muted canvas, so the
4621
+ surface behind it must be the same canvas — otherwise a white frame
4622
+ shows around the gray. */
4623
+ .rich-text-page {
4624
+ background: transparent !important;
4625
+ border-color: transparent;
4626
+ }
4627
+
4628
+ .rich-text-page .content-area {
4629
+ background: transparent;
4630
+ }
4631
+
4559
4632
  .fullscreen-mode {
4560
4633
  position: fixed;
4561
4634
  top: 0;
@@ -115,6 +115,16 @@ function autoResizeTextarea(retries = 5) {
115
115
  return
116
116
  }
117
117
  textarea.style.height = `${textarea.scrollHeight + 1}px`
118
+ // The first measurement can land before the field has its final width — a
119
+ // chat dock still sliding open, a max-width transition, a late stylesheet.
120
+ // scrollHeight is then far too tall and stays locked until the next input.
121
+ // Re-measure once the width settles; identical widths are free no-ops.
122
+ const width = textarea.clientWidth
123
+ if (retries > 0) {
124
+ requestAnimationFrame(() => {
125
+ if (textarea.clientWidth !== width) { autoResizeTextarea(retries - 1) }
126
+ })
127
+ }
118
128
  }
119
129
 
120
130
  function updateInputVal() {