@bagelink/vue 1.20.68 → 1.20.72

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.72",
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.72"
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,63 @@ 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,
103
+ })
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
95
112
  })
96
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
+ html { background: var(--bgl-gray-20, #e6e6e6); }
147
+ body {
148
+ /* Stay inset on every side so the gray canvas frames the sheet. */
149
+ width: auto;
150
+ max-width: none;
151
+ margin: 0.75rem;
152
+ padding: 1.5rem 1.25rem 2.5rem;
153
+ min-height: calc(100vh - 1.5rem);
154
+ }
155
+ }
156
+ `
157
+ }
158
+
97
159
  const emit = defineEmits(['update:modelValue', 'limit-exceeded'])
98
160
 
99
161
  const { shellClass, shellStyle } = useBagelInputShell(props)
@@ -2990,6 +3052,7 @@ async function initEditor() {
2990
3052
  margin: 0 auto;
2991
3053
  unicode-bidi: plaintext;
2992
3054
  }
3055
+ ${pageSheetCss()}
2993
3056
 
2994
3057
  p, h1, h2, h3, h4, h5, h6, blockquote, li {
2995
3058
  unicode-bidi: plaintext;
@@ -3684,6 +3747,7 @@ function updateIframeColors() {
3684
3747
  font-size: ${fontSize} !important;
3685
3748
  font-family: ${currentFontFamily.value} !important;
3686
3749
  }
3750
+ ${pageSheetCss(true)}
3687
3751
 
3688
3752
  /* Body copy inherits the configured base size; headings keep semantic sizes. */
3689
3753
  p, div, li {
@@ -3699,7 +3763,7 @@ function updateIframeColors() {
3699
3763
  }
3700
3764
 
3701
3765
  // Watch for theme changes and update iframe colors
3702
- watch([currentInputColor, currentTextColor, currentFontFamily, effectiveContentStyles], () => {
3766
+ watch([currentInputColor, currentTextColor, currentFontFamily, effectiveContentStyles, pageWidth], () => {
3703
3767
  if (hasInitialized.value) {
3704
3768
  updateIframeColors()
3705
3769
  }
@@ -3837,6 +3901,7 @@ const imgTransform = computed({
3837
3901
  'rich-text-editor--basic': basic,
3838
3902
  'fullscreen-mode': editor.state.isFullscreen,
3839
3903
  'full-height': fullHeight && !editor.state.isFullscreen,
3904
+ 'rich-text-page': pageWidth && !editor.state.isFullscreen,
3840
3905
  },
3841
3906
  ]"
3842
3907
  >
@@ -4556,6 +4621,27 @@ min-height: 0;
4556
4621
  overflow-y: auto;
4557
4622
  }
4558
4623
 
4624
+ /* Page mode: the iframe paints its own canvas, so the surface behind it
4625
+ must not add a second background. */
4626
+ .rich-text-page {
4627
+ background: transparent !important;
4628
+ border-color: transparent;
4629
+ }
4630
+
4631
+ .rich-text-page .content-area {
4632
+ background: transparent;
4633
+ }
4634
+
4635
+ /* On mobile the sheet inside the iframe is inset, so the canvas has to
4636
+ continue behind it or the gap reads as white. Desktop is unchanged. */
4637
+ @media (max-width: 760px) {
4638
+ .rich-text-page,
4639
+ .rich-text-page .content-area,
4640
+ .rich-text-page .editableContent {
4641
+ background: var(--bgl-gray-20);
4642
+ }
4643
+ }
4644
+
4559
4645
  .fullscreen-mode {
4560
4646
  position: fixed;
4561
4647
  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() {