@stoker-platform/web-app 0.5.66 → 0.5.68

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @stoker-platform/web-app
2
2
 
3
+ ## 0.5.68
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: fix chart animation clipping issue
8
+
9
+ ## 0.5.67
10
+
11
+ ### Patch Changes
12
+
13
+ - feat: add rich text editor toolbar features
14
+
3
15
  ## 0.5.66
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoker-platform/web-app",
3
- "version": "0.5.66",
3
+ "version": "0.5.68",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "scripts": {
@@ -70,6 +70,7 @@
70
70
  "moment-timezone": "latest",
71
71
  "qrcode.react": "^4.2.0",
72
72
  "quill": "^2.0.3",
73
+ "quill-table-better": "^1.2.3",
73
74
  "react": "18.3.1",
74
75
  "react-csv": "^2.2.2",
75
76
  "react-day-picker": "^8.10.1",
package/src/App.css CHANGED
@@ -5,6 +5,21 @@
5
5
  }
6
6
  }
7
7
 
8
+ /* Print */
9
+
10
+ @media print {
11
+ body {
12
+ background-color: white !important;
13
+ background-image: none !important;
14
+ }
15
+ .list-table th:first-child,
16
+ .list-table td:first-child {
17
+ display: none;
18
+ }
19
+ }
20
+
21
+ /* FullCalendar */
22
+
8
23
  @media screen and (max-width: 1023px) {
9
24
  .fc-toolbar.fc-header-toolbar {
10
25
  font-size: 85%;
@@ -22,6 +37,8 @@
22
37
  }
23
38
  }
24
39
 
40
+ /* Date range picker */
41
+
25
42
  @media screen and (min-width: 1536px) and (max-width: 1669px) {
26
43
  .date-range-arrow {
27
44
  display: none;
@@ -34,17 +51,14 @@
34
51
  }
35
52
  }
36
53
 
37
- @media print {
38
- body {
39
- background-color: white !important;
40
- background-image: none !important;
41
- }
42
- .list-table th:first-child,
43
- .list-table td:first-child {
44
- display: none;
45
- }
54
+ /* Fix Recharts animation clipping */
55
+
56
+ clipPath[id^="animationClipPath-"] > rect {
57
+ height: 9999px;
46
58
  }
47
59
 
60
+ /* Quill */
61
+
48
62
  .ql-container.ql-snow {
49
63
  border-radius: 0 0 var(--radius) var(--radius) !important;
50
64
  border: 1px solid hsl(var(--border)) !important;
@@ -57,6 +71,9 @@
57
71
  border-radius: var(--radius) var(--radius) 0 0 !important;
58
72
  border: 1px solid hsl(var(--border)) !important;
59
73
  }
74
+ .ql-snow .ql-tooltip {
75
+ left: 0 !important;
76
+ }
60
77
 
61
78
  .dark .ql-toolbar.ql-snow .ql-stroke {
62
79
  stroke: hsl(var(--foreground)) !important;
@@ -101,11 +118,51 @@
101
118
  }
102
119
 
103
120
  .dark .ql-toolbar.ql-snow .ql-picker-item:hover {
104
- background-color: hsl(var(--background)) !important;
105
121
  color: hsl(240 4.9% 83.9%) !important;
106
122
  }
107
123
 
108
124
  .dark .ql-toolbar.ql-snow .ql-picker-item.ql-selected {
109
- background-color: hsl(var(--background)) !important;
110
125
  color: hsl(240 4.9% 83.9%) !important;
111
126
  }
127
+
128
+ .label-field-view-input-wrapper label {
129
+ bottom: 40px !important;
130
+ }
131
+
132
+ .dark .ql-toolbar.ql-snow .ql-table-better svg path {
133
+ fill: hsl(240 4.9% 83.9%) !important;
134
+ }
135
+ .dark .ql-toolbar.ql-snow .ql-table-button-disabled {
136
+ background: transparent !important;
137
+ }
138
+
139
+ .dark .ql-editor table {
140
+ background: #fff;
141
+ color: #222;
142
+ }
143
+
144
+ .dark .ql-editor td,
145
+ .dark .ql-editor th {
146
+ border-color: #bbb !important;
147
+ }
148
+
149
+ .dark .ql-table-menus-container,
150
+ .dark .ql-table-dropdown-list,
151
+ .dark .ql-table-dropdown-properties-list,
152
+ .dark .ql-table-select-container,
153
+ .dark .ql-table-properties-form,
154
+ .dark .ql-table-color-container .color-picker .color-picker-select,
155
+ .dark .ql-table-color-container .color-picker .color-picker-palette {
156
+ background: #fff !important;
157
+ color: #333 !important;
158
+ border-color: #ccced1 !important;
159
+ }
160
+
161
+ .dark .ql-table-select-container span {
162
+ border-color: #000 !important;
163
+ }
164
+
165
+ .dark .ql-table-properties-form .properties-form-header {
166
+ color: #333 !important;
167
+ border-color: #ccced1 !important;
168
+ }
package/src/Form.tsx CHANGED
@@ -140,8 +140,10 @@ import { getSafeUrl } from "./utils/isSafeUrl"
140
140
  import { useConnection } from "./providers/ConnectionProvider"
141
141
  import { getAuth } from "firebase/auth"
142
142
  import Quill, { Delta } from "quill"
143
+ import QuillTableBetter from "quill-table-better"
143
144
  import "quill/dist/quill.core.css"
144
145
  import "quill/dist/quill.snow.css"
146
+ import "quill-table-better/dist/quill-table-better.css"
145
147
  import { Breadcrumbs } from "./Breadcrumbs"
146
148
  import { FilePermissionsDialog, FilePermissions } from "./FilePermissions"
147
149
  import { getStorage, ref, uploadBytesResumable, getDownloadURL } from "firebase/storage"
@@ -1580,6 +1582,13 @@ function ArrayField({
1580
1582
  )
1581
1583
  }
1582
1584
 
1585
+ Quill.register(
1586
+ {
1587
+ "modules/table-better": QuillTableBetter,
1588
+ },
1589
+ true,
1590
+ )
1591
+
1583
1592
  const RichTextEditor = forwardRef<
1584
1593
  Quill,
1585
1594
  { readOnly?: boolean; formField: ControllerRenderProps<FieldValues, string>; isDisabled?: boolean }
@@ -1590,10 +1599,10 @@ const RichTextEditor = forwardRef<
1590
1599
  if (ref && typeof ref === "object" && ref.current) {
1591
1600
  const quill = ref.current
1592
1601
  const currentContents = quill.getContents()
1593
- const newContents = formField.value
1594
-
1595
- if (JSON.stringify(currentContents) !== JSON.stringify(newContents)) {
1596
- quill.setContents(newContents || [])
1602
+ const incoming = new Delta(formField.value?.ops || [])
1603
+ const diff = currentContents.diff(incoming)
1604
+ if (diff.ops?.length > 0) {
1605
+ quill.updateContents(diff, Quill.sources.SILENT)
1597
1606
  }
1598
1607
  }
1599
1608
  }, [ref, formField.value])
@@ -1602,9 +1611,38 @@ const RichTextEditor = forwardRef<
1602
1611
  const container = containerRef.current
1603
1612
  if (!container) return
1604
1613
 
1614
+ const toolbarOptions = [
1615
+ [
1616
+ "table-better",
1617
+ { header: [] },
1618
+ "bold",
1619
+ "italic",
1620
+ "underline",
1621
+ "strike",
1622
+ "link",
1623
+ { align: [] },
1624
+ { list: "ordered" },
1625
+ { list: "bullet" },
1626
+ { color: [] },
1627
+ { background: [] },
1628
+ ],
1629
+ ]
1630
+
1605
1631
  const editorContainer = container.appendChild(container.ownerDocument.createElement("div"))
1606
1632
  const quill = new Quill(editorContainer, {
1607
1633
  theme: "snow",
1634
+ modules: {
1635
+ table: false,
1636
+ toolbar: toolbarOptions,
1637
+ "table-better": {
1638
+ language: "en_US",
1639
+ menus: ["column", "row", "merge", "table", "cell", "wrap", "copy", "delete"],
1640
+ toolbarTable: true,
1641
+ },
1642
+ keyboard: {
1643
+ bindings: QuillTableBetter.keyboardBindings,
1644
+ },
1645
+ },
1608
1646
  })
1609
1647
 
1610
1648
  if (ref && typeof ref === "object") {
@@ -1612,7 +1650,7 @@ const RichTextEditor = forwardRef<
1612
1650
  }
1613
1651
 
1614
1652
  if (formField.value) {
1615
- quill.setContents(formField.value)
1653
+ quill.updateContents(formField.value)
1616
1654
  }
1617
1655
 
1618
1656
  quill.on(Quill.events.TEXT_CHANGE, () => {
@@ -4361,7 +4399,7 @@ function RecordForm({
4361
4399
  </>
4362
4400
  )}
4363
4401
  <Form {...form}>
4364
- <form className="space-y-8 max-w-[750px]">
4402
+ <form className="space-y-8 max-w-[750px]" onSubmit={(e) => e.preventDefault()}>
4365
4403
  {formImagesEnabled && operation === "update" && !isOffline && (
4366
4404
  <div className="flex flex-col gap-3 mt-2">
4367
4405
  <Label>Images</Label>