@beyondwork/docx-react-component 1.0.23 → 1.0.24

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": "@beyondwork/docx-react-component",
3
3
  "publisher": "beyondwork",
4
- "version": "1.0.23",
4
+ "version": "1.0.24",
5
5
  "description": "Embeddable React Word (docx) editor with review, comments, tracked changes, and round-trip OOXML fidelity.",
6
6
  "type": "module",
7
7
  "sideEffects": [
@@ -21,7 +21,22 @@ type RailDecorationSpec = {
21
21
  attrs: Record<string, string>;
22
22
  };
23
23
 
24
- function getWorkflowInlineClass(scope: WorkflowScope, isActiveWorkItem: boolean): string {
24
+ function isSelectionZoneScope(scope: WorkflowScope): boolean {
25
+ return (
26
+ scope.scopeId.startsWith("scope-lab-") ||
27
+ scope.scopeId.startsWith("metadata-lab-") ||
28
+ scope.workItemId?.startsWith("scope-lab-") === true ||
29
+ scope.workItemId?.startsWith("metadata-lab-") === true ||
30
+ scope.label?.toLowerCase().includes("scope lab") === true ||
31
+ scope.label?.toLowerCase().includes("metadata lab") === true
32
+ );
33
+ }
34
+
35
+ function getWorkflowInlineClass(
36
+ scope: WorkflowScope,
37
+ isActiveWorkItem: boolean,
38
+ isSelectionZone: boolean,
39
+ ): string {
25
40
  const base =
26
41
  scope.mode === "edit"
27
42
  ? "wre-workflow-inline wre-workflow-inline-edit"
@@ -30,10 +45,15 @@ function getWorkflowInlineClass(scope: WorkflowScope, isActiveWorkItem: boolean)
30
45
  : scope.mode === "comment"
31
46
  ? "wre-workflow-inline wre-workflow-inline-comment"
32
47
  : "wre-workflow-inline wre-workflow-inline-view";
33
- return isActiveWorkItem ? `${base} wre-workflow-inline-active` : base;
48
+ const withZone = isSelectionZone ? `${base} wre-workflow-inline-zone` : base;
49
+ return isActiveWorkItem ? `${withZone} wre-workflow-inline-active` : withZone;
34
50
  }
35
51
 
36
- function getWorkflowRailClass(scope: WorkflowScope, isActiveWorkItem: boolean): string {
52
+ function getWorkflowRailClass(
53
+ scope: WorkflowScope,
54
+ isActiveWorkItem: boolean,
55
+ isSelectionZone: boolean,
56
+ ): string {
37
57
  const base =
38
58
  scope.mode === "edit"
39
59
  ? "wre-workflow-rail wre-workflow-rail-edit"
@@ -42,7 +62,8 @@ function getWorkflowRailClass(scope: WorkflowScope, isActiveWorkItem: boolean):
42
62
  : scope.mode === "comment"
43
63
  ? "wre-workflow-rail wre-workflow-rail-comment"
44
64
  : "wre-workflow-rail wre-workflow-rail-view";
45
- return isActiveWorkItem ? `${base} wre-workflow-rail-active` : base;
65
+ const withZone = isSelectionZone ? `${base} wre-workflow-rail-selection-zone` : base;
66
+ return isActiveWorkItem ? `${withZone} wre-workflow-rail-active` : withZone;
46
67
  }
47
68
 
48
69
  function getWorkflowCandidateInlineClass(): string {
@@ -271,6 +292,7 @@ export function buildDecorations(
271
292
  if (!storyTargetsEqual(scopeStoryTarget, activeStory)) continue;
272
293
  const pmRange = buildAnchorPmRange(scope.anchor, positionMap);
273
294
  if (!pmRange) continue;
295
+ const isSelectionZone = isSelectionZoneScope(scope);
274
296
  const isActiveWorkItem =
275
297
  Boolean(activeWorkflowWorkItemId) &&
276
298
  (
@@ -281,21 +303,23 @@ export function buildDecorations(
281
303
  if (pmRange.allowInline && pmRange.from < pmRange.to) {
282
304
  decorations.push(
283
305
  Decoration.inline(pmRange.from, pmRange.to, {
284
- class: getWorkflowInlineClass(scope, isActiveWorkItem),
306
+ class: getWorkflowInlineClass(scope, isActiveWorkItem, isSelectionZone),
285
307
  "data-workflow-scope-id": scope.scopeId,
286
308
  "data-workflow-scope-mode": scope.mode,
287
309
  "data-workflow-active": isActiveWorkItem ? "true" : "false",
310
+ ...(isSelectionZone ? { "data-workflow-zone": "selection" } : {}),
288
311
  }),
289
312
  );
290
313
  }
291
314
 
292
315
  pushRailDecorations(decorations, doc, pmRange.from, pmRange.to, {
293
316
  railKind: "scope",
294
- className: getWorkflowRailClass(scope, isActiveWorkItem),
317
+ className: getWorkflowRailClass(scope, isActiveWorkItem, isSelectionZone),
295
318
  attrs: {
296
319
  "data-workflow-scope-id": scope.scopeId,
297
320
  "data-workflow-scope-mode": scope.mode,
298
321
  "data-workflow-active": isActiveWorkItem ? "true" : "false",
322
+ ...(isSelectionZone ? { "data-workflow-zone": "selection" } : {}),
299
323
  },
300
324
  }, railRangeCache);
301
325
  }
@@ -261,6 +261,8 @@
261
261
  .prosemirror-surface .ProseMirror .wre-workflow-inline {
262
262
  border-radius: 0.25rem;
263
263
  box-shadow: inset 0 0 0 1px transparent;
264
+ -webkit-box-decoration-break: clone;
265
+ box-decoration-break: clone;
264
266
  }
265
267
 
266
268
  .prosemirror-surface .ProseMirror .wre-workflow-inline-edit {
@@ -333,6 +335,13 @@
333
335
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--wre-workflow-rail-color, var(--color-border-strong)) 28%, transparent);
334
336
  }
335
337
 
338
+ .prosemirror-surface .ProseMirror .wre-workflow-inline-zone {
339
+ border-radius: 0.35rem;
340
+ box-shadow:
341
+ inset 0 0 0 1px color-mix(in srgb, var(--wre-workflow-rail-color, var(--color-accent)) 18%, transparent),
342
+ inset 0 0 0 999px color-mix(in srgb, var(--wre-workflow-rail-color, var(--color-accent)) 8%, transparent);
343
+ }
344
+
336
345
  .prosemirror-surface .ProseMirror .wre-workflow-rail-edit {
337
346
  --wre-workflow-rail-color: var(--color-accent);
338
347
  background: color-mix(in srgb, var(--color-accent) 7%, transparent);
@@ -394,6 +403,15 @@
394
403
  );
395
404
  }
396
405
 
406
+ .prosemirror-surface .ProseMirror .wre-workflow-rail-selection-zone {
407
+ background: transparent;
408
+ }
409
+
410
+ .prosemirror-surface .ProseMirror .wre-workflow-rail-selection-zone::before {
411
+ width: 0.25rem;
412
+ opacity: 0.95;
413
+ }
414
+
397
415
  .prosemirror-surface:focus-visible {
398
416
  outline: none;
399
417
  }