@alpaca-editor/core 1.0.3762-mono

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.
Files changed (460) hide show
  1. package/.prettierrc +3 -0
  2. package/dist/client-components/api.js +6 -0
  3. package/dist/client-components/index.js +36 -0
  4. package/dist/components/ActionButton.js +9 -0
  5. package/dist/components/Error.js +28 -0
  6. package/dist/config/config.js +654 -0
  7. package/dist/config/types.js +2 -0
  8. package/dist/editor/ComponentInfo.js +31 -0
  9. package/dist/editor/ConfirmationDialog.js +32 -0
  10. package/dist/editor/ContentTree.js +406 -0
  11. package/dist/editor/ContextMenu.js +117 -0
  12. package/dist/editor/Editor.js +55 -0
  13. package/dist/editor/EditorWarning.js +13 -0
  14. package/dist/editor/EditorWarnings.js +24 -0
  15. package/dist/editor/FieldEditorPopup.js +24 -0
  16. package/dist/editor/FieldHistory.js +40 -0
  17. package/dist/editor/FieldList.js +63 -0
  18. package/dist/editor/FieldListField.js +164 -0
  19. package/dist/editor/FieldListFieldWithFallbacks.js +114 -0
  20. package/dist/editor/FloatingToolbar.js +92 -0
  21. package/dist/editor/ImageEditor.js +55 -0
  22. package/dist/editor/InsertMenu.js +164 -0
  23. package/dist/editor/ItemInfo.js +30 -0
  24. package/dist/editor/LinkEditorDialog.js +89 -0
  25. package/dist/editor/MainLayout.js +46 -0
  26. package/dist/editor/NewEditorClient.js +9 -0
  27. package/dist/editor/PictureCropper.js +332 -0
  28. package/dist/editor/PictureEditor.js +104 -0
  29. package/dist/editor/PictureEditorDialog.js +194 -0
  30. package/dist/editor/ScrollingContentTree.js +30 -0
  31. package/dist/editor/Terminal.js +109 -0
  32. package/dist/editor/Titlebar.js +11 -0
  33. package/dist/editor/ai/AiPopup.js +25 -0
  34. package/dist/editor/ai/AiResponseMessage.js +24 -0
  35. package/dist/editor/ai/AiTerminal.js +241 -0
  36. package/dist/editor/ai/AiToolCall.js +18 -0
  37. package/dist/editor/ai/EditorAiTerminal.js +9 -0
  38. package/dist/editor/ai/editorAiContext.js +14 -0
  39. package/dist/editor/client/DialogContext.js +29 -0
  40. package/dist/editor/client/EditorClient.js +1336 -0
  41. package/dist/editor/client/GenericDialog.js +27 -0
  42. package/dist/editor/client/editContext.js +59 -0
  43. package/dist/editor/client/helpers.js +31 -0
  44. package/dist/editor/client/itemsRepository.js +255 -0
  45. package/dist/editor/client/operations.js +398 -0
  46. package/dist/editor/client/pageModelBuilder.js +129 -0
  47. package/dist/editor/commands/commands.js +2 -0
  48. package/dist/editor/commands/componentCommands.js +277 -0
  49. package/dist/editor/commands/createVersionCommand.js +26 -0
  50. package/dist/editor/commands/deleteVersionCommand.js +55 -0
  51. package/dist/editor/commands/itemCommands.js +134 -0
  52. package/dist/editor/commands/localizeItem/LocalizeItemDialog.js +94 -0
  53. package/dist/editor/commands/undo.js +32 -0
  54. package/dist/editor/component-designer/ComponentDesigner.js +58 -0
  55. package/dist/editor/component-designer/ComponentDesignerAiTerminal.js +9 -0
  56. package/dist/editor/component-designer/ComponentDesignerMenu.js +67 -0
  57. package/dist/editor/component-designer/ComponentEditor.js +59 -0
  58. package/dist/editor/component-designer/ComponentRenderingCodeEditor.js +16 -0
  59. package/dist/editor/component-designer/ComponentRenderingEditor.js +71 -0
  60. package/dist/editor/component-designer/ComponentsDropdown.js +22 -0
  61. package/dist/editor/component-designer/PlaceholdersEditor.js +70 -0
  62. package/dist/editor/component-designer/RenderingsDropdown.js +25 -0
  63. package/dist/editor/component-designer/TemplateEditor.js +144 -0
  64. package/dist/editor/component-designer/aiContext.js +18 -0
  65. package/dist/editor/componentTreeHelper.js +97 -0
  66. package/dist/editor/control-center/ControlCenterMenu.js +59 -0
  67. package/dist/editor/control-center/IndexOverview.js +27 -0
  68. package/dist/editor/control-center/IndexSettings.js +106 -0
  69. package/dist/editor/control-center/Status.js +7 -0
  70. package/dist/editor/editor-warnings/ItemLocked.js +40 -0
  71. package/dist/editor/editor-warnings/NoLanguageWriteAccess.js +16 -0
  72. package/dist/editor/editor-warnings/NoWorkflowWriteAccess.js +16 -0
  73. package/dist/editor/editor-warnings/NoWriteAccess.js +14 -0
  74. package/dist/editor/editor-warnings/ValidationErrors.js +27 -0
  75. package/dist/editor/field-types/AttachmentEditor.js +7 -0
  76. package/dist/editor/field-types/CheckboxEditor.js +32 -0
  77. package/dist/editor/field-types/DropLinkEditor.js +51 -0
  78. package/dist/editor/field-types/DropListEditor.js +58 -0
  79. package/dist/editor/field-types/ImageFieldEditor.js +36 -0
  80. package/dist/editor/field-types/InternalLinkFieldEditor.js +64 -0
  81. package/dist/editor/field-types/LinkFieldEditor.js +58 -0
  82. package/dist/editor/field-types/MultiLineText.js +35 -0
  83. package/dist/editor/field-types/PictureFieldEditor.js +59 -0
  84. package/dist/editor/field-types/RawEditor.js +33 -0
  85. package/dist/editor/field-types/ReactQuill.js +366 -0
  86. package/dist/editor/field-types/RichTextEditor.js +46 -0
  87. package/dist/editor/field-types/RichTextEditorComponent.js +72 -0
  88. package/dist/editor/field-types/SingleLineText.js +92 -0
  89. package/dist/editor/field-types/TreeListEditor.js +137 -0
  90. package/dist/editor/fieldTypes.js +2 -0
  91. package/dist/editor/media-selector/AiImageSearch.js +110 -0
  92. package/dist/editor/media-selector/AiImageSearchPrompt.js +58 -0
  93. package/dist/editor/media-selector/MediaSelector.js +11 -0
  94. package/dist/editor/media-selector/Preview.js +9 -0
  95. package/dist/editor/media-selector/Thumbnails.js +11 -0
  96. package/dist/editor/media-selector/TreeSelector.js +171 -0
  97. package/dist/editor/media-selector/UploadZone.js +80 -0
  98. package/dist/editor/menubar/ActionsMenu.js +33 -0
  99. package/dist/editor/menubar/ActiveUsers.js +13 -0
  100. package/dist/editor/menubar/ApproveAndPublish.js +13 -0
  101. package/dist/editor/menubar/BrowseHistory.js +14 -0
  102. package/dist/editor/menubar/ItemLanguageVersion.js +36 -0
  103. package/dist/editor/menubar/LanguageSelector.js +33 -0
  104. package/dist/editor/menubar/Menu.js +65 -0
  105. package/dist/editor/menubar/NavButtons.js +43 -0
  106. package/dist/editor/menubar/PageSelector.js +50 -0
  107. package/dist/editor/menubar/PageViewerControls.js +37 -0
  108. package/dist/editor/menubar/Separator.js +8 -0
  109. package/dist/editor/menubar/SiteInfo.js +26 -0
  110. package/dist/editor/menubar/User.js +18 -0
  111. package/dist/editor/menubar/VersionSelector.js +49 -0
  112. package/dist/editor/page-editor-chrome/CommentHighlighting.js +214 -0
  113. package/dist/editor/page-editor-chrome/CommentHighlightings.js +17 -0
  114. package/dist/editor/page-editor-chrome/FieldActionIndicator.js +27 -0
  115. package/dist/editor/page-editor-chrome/FieldActionIndicators.js +15 -0
  116. package/dist/editor/page-editor-chrome/FieldEditedIndicator.js +27 -0
  117. package/dist/editor/page-editor-chrome/FieldEditedIndicators.js +15 -0
  118. package/dist/editor/page-editor-chrome/FrameMenu.js +178 -0
  119. package/dist/editor/page-editor-chrome/FrameMenus.js +24 -0
  120. package/dist/editor/page-editor-chrome/InlineEditor.js +101 -0
  121. package/dist/editor/page-editor-chrome/LockedFieldIndicator.js +35 -0
  122. package/dist/editor/page-editor-chrome/NoLayout.js +21 -0
  123. package/dist/editor/page-editor-chrome/PageEditorChrome.js +65 -0
  124. package/dist/editor/page-editor-chrome/PictureEditorOverlay.js +109 -0
  125. package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +82 -0
  126. package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +147 -0
  127. package/dist/editor/page-viewer/DeviceToolbar.js +21 -0
  128. package/dist/editor/page-viewer/EditorForm.js +130 -0
  129. package/dist/editor/page-viewer/MiniMap.js +257 -0
  130. package/dist/editor/page-viewer/PageViewer.js +64 -0
  131. package/dist/editor/page-viewer/PageViewerFrame.js +696 -0
  132. package/dist/editor/page-viewer/pageViewContext.js +117 -0
  133. package/dist/editor/pageModel.js +2 -0
  134. package/dist/editor/picture-shared.js +28 -0
  135. package/dist/editor/reviews/Comment.js +112 -0
  136. package/dist/editor/reviews/Comments.js +24 -0
  137. package/dist/editor/reviews/PreviewInfo.js +13 -0
  138. package/dist/editor/reviews/Reviews.js +165 -0
  139. package/dist/editor/reviews/reviewCommands.js +44 -0
  140. package/dist/editor/reviews/useReviews.js +48 -0
  141. package/dist/editor/services/aiService.js +99 -0
  142. package/dist/editor/services/componentDesignerService.js +79 -0
  143. package/dist/editor/services/contentService.js +104 -0
  144. package/dist/editor/services/editService.js +322 -0
  145. package/dist/editor/services/indexService.js +25 -0
  146. package/dist/editor/services/reviewsService.js +43 -0
  147. package/dist/editor/services/serviceHelper.js +67 -0
  148. package/dist/editor/services/systemService.js +7 -0
  149. package/dist/editor/services/translationService.js +15 -0
  150. package/dist/editor/services-server/api.js +119 -0
  151. package/dist/editor/services-server/graphQL.js +56 -0
  152. package/dist/editor/sidebar/ComponentPalette.js +55 -0
  153. package/dist/editor/sidebar/ComponentTree.js +362 -0
  154. package/dist/editor/sidebar/Debug.js +60 -0
  155. package/dist/editor/sidebar/DictionaryEditor.js +160 -0
  156. package/dist/editor/sidebar/EditHistory.js +74 -0
  157. package/dist/editor/sidebar/GraphQL.js +115 -0
  158. package/dist/editor/sidebar/Insert.js +24 -0
  159. package/dist/editor/sidebar/MainContentTree.js +52 -0
  160. package/dist/editor/sidebar/Performance.js +34 -0
  161. package/dist/editor/sidebar/Sessions.js +31 -0
  162. package/dist/editor/sidebar/Sidebar.js +15 -0
  163. package/dist/editor/sidebar/SidebarView.js +76 -0
  164. package/dist/editor/sidebar/Translations.js +160 -0
  165. package/dist/editor/sidebar/Validation.js +52 -0
  166. package/dist/editor/sidebar/ViewSelector.js +15 -0
  167. package/dist/editor/sidebar/Workbox.js +80 -0
  168. package/dist/editor/ui/CenteredMessage.js +7 -0
  169. package/dist/editor/ui/CopyToClipboardButton.js +17 -0
  170. package/dist/editor/ui/DialogButtons.js +7 -0
  171. package/dist/editor/ui/Icons.js +75 -0
  172. package/dist/editor/ui/ItemNameDialog.js +45 -0
  173. package/dist/editor/ui/ItemNameDialogNew.js +61 -0
  174. package/dist/editor/ui/ItemSearch.js +93 -0
  175. package/dist/editor/ui/PerfectTree.js +223 -0
  176. package/dist/editor/ui/Section.js +12 -0
  177. package/dist/editor/ui/SimpleIconButton.js +11 -0
  178. package/dist/editor/ui/SimpleMenu.js +9 -0
  179. package/dist/editor/ui/SimpleTable.js +11 -0
  180. package/dist/editor/ui/SimpleTabs.js +21 -0
  181. package/dist/editor/ui/SimpleToolbar.js +7 -0
  182. package/dist/editor/ui/Spinner.js +7 -0
  183. package/dist/editor/ui/Splitter.js +187 -0
  184. package/dist/editor/ui/StackedPanels.js +69 -0
  185. package/dist/editor/ui/Toolbar.js +7 -0
  186. package/dist/editor/utils/id-helper.js +7 -0
  187. package/dist/editor/utils/insertOptions.js +45 -0
  188. package/dist/editor/utils/itemutils.js +25 -0
  189. package/dist/editor/utils/useMemoDebug.js +20 -0
  190. package/dist/editor/utils.js +328 -0
  191. package/dist/editor/views/CompareView.js +147 -0
  192. package/dist/editor/views/EditView.js +17 -0
  193. package/dist/editor/views/ItemEditor.js +24 -0
  194. package/dist/editor/views/SingleEditView.js +25 -0
  195. package/dist/index.js +22 -0
  196. package/dist/page-wizard/PageWizard.js +62 -0
  197. package/dist/page-wizard/SelectWizard.js +43 -0
  198. package/dist/page-wizard/WizardSteps.js +71 -0
  199. package/dist/page-wizard/service.js +26 -0
  200. package/dist/page-wizard/startPageWizardCommand.js +23 -0
  201. package/dist/page-wizard/steps/BuildPageStep.js +138 -0
  202. package/dist/page-wizard/steps/CollectStep.js +124 -0
  203. package/dist/page-wizard/steps/ComponentTypesSelector.js +211 -0
  204. package/dist/page-wizard/steps/Components.js +94 -0
  205. package/dist/page-wizard/steps/CreatePage.js +142 -0
  206. package/dist/page-wizard/steps/CreatePageAndLayoutStep.js +230 -0
  207. package/dist/page-wizard/steps/EditButton.js +7 -0
  208. package/dist/page-wizard/steps/FieldEditor.js +30 -0
  209. package/dist/page-wizard/steps/Generate.js +11 -0
  210. package/dist/page-wizard/steps/ImagesStep.js +159 -0
  211. package/dist/page-wizard/steps/LayoutStep.js +120 -0
  212. package/dist/page-wizard/steps/SelectStep.js +150 -0
  213. package/dist/page-wizard/steps/schema.js +140 -0
  214. package/dist/page-wizard/steps/usePageCreator.js +194 -0
  215. package/dist/splash-screen/NewPage.js +131 -0
  216. package/dist/splash-screen/SectionHeadline.js +9 -0
  217. package/dist/splash-screen/SplashScreen.js +81 -0
  218. package/dist/tour/Tour.js +321 -0
  219. package/dist/tour/default-tour.js +231 -0
  220. package/dist/tour/preview-tour.js +93 -0
  221. package/dist/tsconfig.build.tsbuildinfo +1 -0
  222. package/dist/types.js +2 -0
  223. package/eslint.config.mjs +4 -0
  224. package/images/bg-shape-black.webp +0 -0
  225. package/package.json +52 -0
  226. package/src/client-components/api.ts +6 -0
  227. package/src/client-components/index.ts +19 -0
  228. package/src/components/ActionButton.tsx +43 -0
  229. package/src/components/Error.tsx +57 -0
  230. package/src/config/config.tsx +737 -0
  231. package/src/config/types.ts +263 -0
  232. package/src/editor/ComponentInfo.tsx +77 -0
  233. package/src/editor/ConfirmationDialog.tsx +103 -0
  234. package/src/editor/ContentTree.tsx +654 -0
  235. package/src/editor/ContextMenu.tsx +155 -0
  236. package/src/editor/Editor.tsx +91 -0
  237. package/src/editor/EditorWarning.tsx +34 -0
  238. package/src/editor/EditorWarnings.tsx +33 -0
  239. package/src/editor/FieldEditorPopup.tsx +65 -0
  240. package/src/editor/FieldHistory.tsx +74 -0
  241. package/src/editor/FieldList.tsx +190 -0
  242. package/src/editor/FieldListField.tsx +387 -0
  243. package/src/editor/FieldListFieldWithFallbacks.tsx +211 -0
  244. package/src/editor/FloatingToolbar.tsx +163 -0
  245. package/src/editor/ImageEditor.tsx +129 -0
  246. package/src/editor/InsertMenu.tsx +332 -0
  247. package/src/editor/ItemInfo.tsx +90 -0
  248. package/src/editor/LinkEditorDialog.tsx +192 -0
  249. package/src/editor/MainLayout.tsx +94 -0
  250. package/src/editor/NewEditorClient.tsx +11 -0
  251. package/src/editor/PictureCropper.tsx +505 -0
  252. package/src/editor/PictureEditor.tsx +206 -0
  253. package/src/editor/PictureEditorDialog.tsx +381 -0
  254. package/src/editor/PublishDialog.ignore +74 -0
  255. package/src/editor/ScrollingContentTree.tsx +47 -0
  256. package/src/editor/Terminal.tsx +215 -0
  257. package/src/editor/Titlebar.tsx +23 -0
  258. package/src/editor/ai/AiPopup.tsx +59 -0
  259. package/src/editor/ai/AiResponseMessage.tsx +82 -0
  260. package/src/editor/ai/AiTerminal.tsx +450 -0
  261. package/src/editor/ai/AiToolCall.tsx +46 -0
  262. package/src/editor/ai/EditorAiTerminal.tsx +20 -0
  263. package/src/editor/ai/editorAiContext.ts +18 -0
  264. package/src/editor/client/DialogContext.tsx +49 -0
  265. package/src/editor/client/EditorClient.tsx +1831 -0
  266. package/src/editor/client/GenericDialog.tsx +50 -0
  267. package/src/editor/client/editContext.ts +330 -0
  268. package/src/editor/client/helpers.ts +44 -0
  269. package/src/editor/client/itemsRepository.ts +391 -0
  270. package/src/editor/client/operations.ts +610 -0
  271. package/src/editor/client/pageModelBuilder.ts +182 -0
  272. package/src/editor/commands/commands.ts +23 -0
  273. package/src/editor/commands/componentCommands.tsx +408 -0
  274. package/src/editor/commands/createVersionCommand.ts +33 -0
  275. package/src/editor/commands/deleteVersionCommand.ts +71 -0
  276. package/src/editor/commands/itemCommands.tsx +186 -0
  277. package/src/editor/commands/localizeItem/LocalizeItemDialog.tsx +201 -0
  278. package/src/editor/commands/undo.ts +39 -0
  279. package/src/editor/component-designer/ComponentDesigner.tsx +70 -0
  280. package/src/editor/component-designer/ComponentDesignerAiTerminal.tsx +11 -0
  281. package/src/editor/component-designer/ComponentDesignerMenu.tsx +91 -0
  282. package/src/editor/component-designer/ComponentEditor.tsx +97 -0
  283. package/src/editor/component-designer/ComponentRenderingCodeEditor.tsx +31 -0
  284. package/src/editor/component-designer/ComponentRenderingEditor.tsx +104 -0
  285. package/src/editor/component-designer/ComponentsDropdown.tsx +39 -0
  286. package/src/editor/component-designer/PlaceholdersEditor.tsx +183 -0
  287. package/src/editor/component-designer/RenderingsDropdown.tsx +36 -0
  288. package/src/editor/component-designer/TemplateEditor.tsx +236 -0
  289. package/src/editor/component-designer/aiContext.ts +23 -0
  290. package/src/editor/componentTreeHelper.tsx +114 -0
  291. package/src/editor/control-center/ControlCenterMenu.tsx +71 -0
  292. package/src/editor/control-center/IndexOverview.tsx +50 -0
  293. package/src/editor/control-center/IndexSettings.tsx +266 -0
  294. package/src/editor/control-center/Status.tsx +7 -0
  295. package/src/editor/editor-warnings/ItemLocked.tsx +63 -0
  296. package/src/editor/editor-warnings/NoLanguageWriteAccess.tsx +22 -0
  297. package/src/editor/editor-warnings/NoWorkflowWriteAccess.tsx +23 -0
  298. package/src/editor/editor-warnings/NoWriteAccess.tsx +15 -0
  299. package/src/editor/editor-warnings/ValidationErrors.tsx +54 -0
  300. package/src/editor/field-types/AttachmentEditor.tsx +9 -0
  301. package/src/editor/field-types/CheckboxEditor.tsx +47 -0
  302. package/src/editor/field-types/DropLinkEditor.tsx +75 -0
  303. package/src/editor/field-types/DropListEditor.tsx +84 -0
  304. package/src/editor/field-types/ImageFieldEditor.tsx +65 -0
  305. package/src/editor/field-types/InternalLinkFieldEditor.tsx +112 -0
  306. package/src/editor/field-types/LinkFieldEditor.tsx +85 -0
  307. package/src/editor/field-types/MultiLineText.tsx +63 -0
  308. package/src/editor/field-types/PictureFieldEditor.tsx +121 -0
  309. package/src/editor/field-types/RawEditor.tsx +53 -0
  310. package/src/editor/field-types/ReactQuill.tsx +580 -0
  311. package/src/editor/field-types/RichTextEditor.tsx +22 -0
  312. package/src/editor/field-types/RichTextEditorComponent.tsx +108 -0
  313. package/src/editor/field-types/SingleLineText.tsx +150 -0
  314. package/src/editor/field-types/TreeListEditor.tsx +261 -0
  315. package/src/editor/fieldTypes.ts +140 -0
  316. package/src/editor/media-selector/AiImageSearch.tsx +186 -0
  317. package/src/editor/media-selector/AiImageSearchPrompt.tsx +95 -0
  318. package/src/editor/media-selector/MediaSelector.tsx +42 -0
  319. package/src/editor/media-selector/Preview.tsx +14 -0
  320. package/src/editor/media-selector/Thumbnails.tsx +48 -0
  321. package/src/editor/media-selector/TreeSelector.tsx +292 -0
  322. package/src/editor/media-selector/UploadZone.tsx +137 -0
  323. package/src/editor/menubar/ActionsMenu.tsx +47 -0
  324. package/src/editor/menubar/ActiveUsers.tsx +17 -0
  325. package/src/editor/menubar/ApproveAndPublish.tsx +18 -0
  326. package/src/editor/menubar/BrowseHistory.tsx +37 -0
  327. package/src/editor/menubar/ItemLanguageVersion.tsx +52 -0
  328. package/src/editor/menubar/LanguageSelector.tsx +152 -0
  329. package/src/editor/menubar/Menu.tsx +83 -0
  330. package/src/editor/menubar/NavButtons.tsx +74 -0
  331. package/src/editor/menubar/PageSelector.tsx +139 -0
  332. package/src/editor/menubar/PageViewerControls.tsx +99 -0
  333. package/src/editor/menubar/Separator.tsx +12 -0
  334. package/src/editor/menubar/SiteInfo.tsx +53 -0
  335. package/src/editor/menubar/User.tsx +27 -0
  336. package/src/editor/menubar/VersionSelector.tsx +143 -0
  337. package/src/editor/page-editor-chrome/CommentHighlighting.tsx +287 -0
  338. package/src/editor/page-editor-chrome/CommentHighlightings.tsx +35 -0
  339. package/src/editor/page-editor-chrome/FieldActionIndicator.tsx +44 -0
  340. package/src/editor/page-editor-chrome/FieldActionIndicators.tsx +23 -0
  341. package/src/editor/page-editor-chrome/FieldEditedIndicator.tsx +64 -0
  342. package/src/editor/page-editor-chrome/FieldEditedIndicators.tsx +35 -0
  343. package/src/editor/page-editor-chrome/FrameMenu.tsx +263 -0
  344. package/src/editor/page-editor-chrome/FrameMenus.tsx +48 -0
  345. package/src/editor/page-editor-chrome/InlineEditor.tsx +147 -0
  346. package/src/editor/page-editor-chrome/LockedFieldIndicator.tsx +61 -0
  347. package/src/editor/page-editor-chrome/NoLayout.tsx +36 -0
  348. package/src/editor/page-editor-chrome/PageEditorChrome.tsx +119 -0
  349. package/src/editor/page-editor-chrome/PictureEditorOverlay.tsx +154 -0
  350. package/src/editor/page-editor-chrome/PlaceholderDropZone.tsx +171 -0
  351. package/src/editor/page-editor-chrome/PlaceholderDropZones.tsx +233 -0
  352. package/src/editor/page-viewer/DeviceToolbar.tsx +70 -0
  353. package/src/editor/page-viewer/EditorForm.tsx +247 -0
  354. package/src/editor/page-viewer/MiniMap.tsx +351 -0
  355. package/src/editor/page-viewer/PageViewer.tsx +127 -0
  356. package/src/editor/page-viewer/PageViewerFrame.tsx +1030 -0
  357. package/src/editor/page-viewer/pageViewContext.ts +186 -0
  358. package/src/editor/pageModel.ts +191 -0
  359. package/src/editor/picture-shared.tsx +53 -0
  360. package/src/editor/reviews/Comment.tsx +265 -0
  361. package/src/editor/reviews/Comments.tsx +50 -0
  362. package/src/editor/reviews/PreviewInfo.tsx +35 -0
  363. package/src/editor/reviews/Reviews.tsx +280 -0
  364. package/src/editor/reviews/reviewCommands.tsx +47 -0
  365. package/src/editor/reviews/useReviews.tsx +70 -0
  366. package/src/editor/services/aiService.ts +155 -0
  367. package/src/editor/services/componentDesignerService.ts +151 -0
  368. package/src/editor/services/contentService.ts +159 -0
  369. package/src/editor/services/editService.ts +462 -0
  370. package/src/editor/services/indexService.ts +24 -0
  371. package/src/editor/services/reviewsService.ts +45 -0
  372. package/src/editor/services/serviceHelper.ts +95 -0
  373. package/src/editor/services/systemService.ts +5 -0
  374. package/src/editor/services/translationService.ts +21 -0
  375. package/src/editor/services-server/api.ts +150 -0
  376. package/src/editor/services-server/graphQL.ts +106 -0
  377. package/src/editor/sidebar/ComponentPalette.tsx +146 -0
  378. package/src/editor/sidebar/ComponentTree.tsx +512 -0
  379. package/src/editor/sidebar/ComponentTree2.tsxx +490 -0
  380. package/src/editor/sidebar/Debug.tsx +105 -0
  381. package/src/editor/sidebar/DictionaryEditor.tsx +261 -0
  382. package/src/editor/sidebar/EditHistory.tsx +134 -0
  383. package/src/editor/sidebar/GraphQL.tsx +164 -0
  384. package/src/editor/sidebar/Insert.tsx +35 -0
  385. package/src/editor/sidebar/MainContentTree.tsx +95 -0
  386. package/src/editor/sidebar/Performance.tsx +53 -0
  387. package/src/editor/sidebar/Sessions.tsx +35 -0
  388. package/src/editor/sidebar/Sidebar.tsx +20 -0
  389. package/src/editor/sidebar/SidebarView.tsx +150 -0
  390. package/src/editor/sidebar/Translations.tsx +276 -0
  391. package/src/editor/sidebar/Validation.tsx +102 -0
  392. package/src/editor/sidebar/ViewSelector.tsx +49 -0
  393. package/src/editor/sidebar/Workbox.tsx +209 -0
  394. package/src/editor/ui/CenteredMessage.tsx +7 -0
  395. package/src/editor/ui/CopyToClipboardButton.tsx +23 -0
  396. package/src/editor/ui/DialogButtons.tsx +11 -0
  397. package/src/editor/ui/Icons.tsx +585 -0
  398. package/src/editor/ui/ItemNameDialog.tsx +94 -0
  399. package/src/editor/ui/ItemNameDialogNew.tsx +118 -0
  400. package/src/editor/ui/ItemSearch.tsx +173 -0
  401. package/src/editor/ui/PerfectTree.tsx +550 -0
  402. package/src/editor/ui/Section.tsx +35 -0
  403. package/src/editor/ui/SimpleIconButton.tsx +43 -0
  404. package/src/editor/ui/SimpleMenu.tsx +48 -0
  405. package/src/editor/ui/SimpleTable.tsx +63 -0
  406. package/src/editor/ui/SimpleTabs.tsx +55 -0
  407. package/src/editor/ui/SimpleToolbar.tsx +7 -0
  408. package/src/editor/ui/Spinner.tsx +7 -0
  409. package/src/editor/ui/Splitter.tsx +247 -0
  410. package/src/editor/ui/StackedPanels.tsx +134 -0
  411. package/src/editor/ui/Toolbar.tsx +7 -0
  412. package/src/editor/utils/id-helper.ts +3 -0
  413. package/src/editor/utils/insertOptions.ts +69 -0
  414. package/src/editor/utils/itemutils.ts +29 -0
  415. package/src/editor/utils/useMemoDebug.ts +28 -0
  416. package/src/editor/utils.ts +435 -0
  417. package/src/editor/views/CompareView.tsx +256 -0
  418. package/src/editor/views/EditView.tsx +27 -0
  419. package/src/editor/views/ItemEditor.tsx +58 -0
  420. package/src/editor/views/SingleEditView.tsx +44 -0
  421. package/src/fonts/Geist-Black.woff2 +0 -0
  422. package/src/fonts/Geist-Bold.woff2 +0 -0
  423. package/src/fonts/Geist-ExtraBold.woff2 +0 -0
  424. package/src/fonts/Geist-ExtraLight.woff2 +0 -0
  425. package/src/fonts/Geist-Light.woff2 +0 -0
  426. package/src/fonts/Geist-Medium.woff2 +0 -0
  427. package/src/fonts/Geist-Regular.woff2 +0 -0
  428. package/src/fonts/Geist-SemiBold.woff2 +0 -0
  429. package/src/fonts/Geist-Thin.woff2 +0 -0
  430. package/src/fonts/Geist[wght].woff2 +0 -0
  431. package/src/index.ts +7 -0
  432. package/src/page-wizard/PageWizard.tsx +163 -0
  433. package/src/page-wizard/SelectWizard.tsx +109 -0
  434. package/src/page-wizard/WizardSteps.tsx +207 -0
  435. package/src/page-wizard/service.ts +35 -0
  436. package/src/page-wizard/startPageWizardCommand.ts +27 -0
  437. package/src/page-wizard/steps/BuildPageStep.tsx +266 -0
  438. package/src/page-wizard/steps/CollectStep.tsx +233 -0
  439. package/src/page-wizard/steps/ComponentTypesSelector.tsx +443 -0
  440. package/src/page-wizard/steps/Components.tsx +193 -0
  441. package/src/page-wizard/steps/CreatePage.tsx +285 -0
  442. package/src/page-wizard/steps/CreatePageAndLayoutStep.tsx +384 -0
  443. package/src/page-wizard/steps/EditButton.tsx +34 -0
  444. package/src/page-wizard/steps/FieldEditor.tsx +102 -0
  445. package/src/page-wizard/steps/Generate.tsx +32 -0
  446. package/src/page-wizard/steps/ImagesStep.tsx +318 -0
  447. package/src/page-wizard/steps/LayoutStep.tsx +228 -0
  448. package/src/page-wizard/steps/SelectStep.tsx +256 -0
  449. package/src/page-wizard/steps/schema.ts +180 -0
  450. package/src/page-wizard/steps/usePageCreator.ts +279 -0
  451. package/src/splash-screen/NewPage.tsx +232 -0
  452. package/src/splash-screen/SectionHeadline.tsx +21 -0
  453. package/src/splash-screen/SplashScreen.tsx +156 -0
  454. package/src/tour/Tour.tsx +558 -0
  455. package/src/tour/default-tour.tsx +300 -0
  456. package/src/tour/preview-tour.tsx +127 -0
  457. package/src/types.ts +302 -0
  458. package/styles.css +476 -0
  459. package/tsconfig.build.json +21 -0
  460. package/tsconfig.json +11 -0
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.MultiLineText = MultiLineText;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const inputtextarea_1 = require("primereact/inputtextarea");
7
+ const editContext_1 = require("../client/editContext");
8
+ const react_1 = require("react");
9
+ function MultiLineText({ field, readOnly, updateFieldValue, }) {
10
+ const editContextRef = (0, editContext_1.useEditContextRef)();
11
+ const inputRef = (0, react_1.useRef)(null);
12
+ const fieldItem = field.descriptor.item;
13
+ const [value, setValue] = (0, react_1.useState)(field.value);
14
+ const modifiedFieldsContext = (0, editContext_1.useModifiedFieldsContext)();
15
+ const modifiedField = modifiedFieldsContext?.modifiedFields.find((x) => x.fieldId === field.id &&
16
+ x.item.id === fieldItem.id &&
17
+ x.item.language === fieldItem.language &&
18
+ x.item.version === fieldItem.version);
19
+ (0, react_1.useEffect)(() => {
20
+ if (inputRef.current !== document.activeElement) {
21
+ if (field.isHistoric)
22
+ setValue(field.value);
23
+ else
24
+ setValue(modifiedField?.value ?? field.value);
25
+ }
26
+ }, [field.value, modifiedFieldsContext?.modifiedFields]);
27
+ if (!editContextRef.current)
28
+ return;
29
+ if (!fieldItem)
30
+ return;
31
+ return ((0, jsx_runtime_1.jsx)(inputtextarea_1.InputTextarea, { ref: inputRef, value: value, disabled: readOnly, className: "p-2 focus-shadow text-sm", style: { width: "100%" }, rows: 12, onChange: (e) => {
32
+ setValue(e.target.value);
33
+ updateFieldValue(e.target.value);
34
+ } }, fieldItem.id + field.id + fieldItem.language + fieldItem.version));
35
+ }
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.PictureFieldEditor = PictureFieldEditor;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const editContext_1 = require("../client/editContext");
7
+ const inputtext_1 = require("primereact/inputtext");
8
+ const PictureEditor_1 = require("../PictureEditor");
9
+ const react_1 = require("react");
10
+ const SimpleIconButton_1 = require("../ui/SimpleIconButton");
11
+ function PictureFieldEditor({ field, readOnly, }) {
12
+ const editContext = (0, editContext_1.useEditContext)();
13
+ const [altText, setAltText] = (0, react_1.useState)("");
14
+ if (!field || !editContext)
15
+ return;
16
+ var item = field.descriptor.item;
17
+ (0, react_1.useEffect)(() => {
18
+ setAltText(field.value?.alt || "");
19
+ }, [field.value?.alt]);
20
+ if (field.value?.error) {
21
+ return (0, jsx_runtime_1.jsx)("div", { children: field.value?.error });
22
+ }
23
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "flex gap-2 h-full focus-shadow flex-wrap", children: field?.value?.variants?.map((variant) => ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "h-48 w-48 border border-gray-300 relative cursor-pointer flex justify-center items-center", children: [variant.src && (0, jsx_runtime_1.jsx)("img", { src: variant.thumbSrc }), !readOnly && ((0, jsx_runtime_1.jsx)(PictureEditor_1.PictureEditor, { field: field, variantName: variant.name }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "p-1", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs", children: variant.name }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs", children: variant.aspectRatioLockText })] }), variant.videoUrl && ((0, jsx_runtime_1.jsxs)("div", { className: "text-xs", children: ["Video: ", variant.videoUrl, (0, jsx_runtime_1.jsx)(SimpleIconButton_1.SimpleIconButton, { onClick: () => {
24
+ const raw = field.rawValue
25
+ ? JSON.parse(field?.rawValue)
26
+ : { Variants: [] };
27
+ if (!raw.Variants)
28
+ return;
29
+ let rawVariant = raw.Variants.find((v) => v.Name === variant.name);
30
+ if (rawVariant) {
31
+ rawVariant.VideoId = undefined;
32
+ }
33
+ else {
34
+ rawVariant = {
35
+ Name: variant.name,
36
+ VideoId: undefined,
37
+ };
38
+ raw.Variants.push(rawVariant);
39
+ }
40
+ editContext.operations.editField({
41
+ field: field.descriptor,
42
+ rawValue: JSON.stringify(raw),
43
+ refresh: "immediate",
44
+ });
45
+ }, icon: "pi pi-trash", label: "Remove" })] }))] }, variant.name))) }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "mb-1", children: "Alt Text" }), (0, jsx_runtime_1.jsx)(inputtext_1.InputText, { value: altText, disabled: readOnly, className: "p-2 focus-shadow text-sm", style: { width: "100%" }, onChange: (e) => {
46
+ setAltText(e.target.value);
47
+ const raw = field?.rawValue
48
+ ? JSON.parse(field?.rawValue)
49
+ : { Variants: [] };
50
+ raw.AltText = e.target.value;
51
+ if (field.value)
52
+ field.value.alt = e.target.value;
53
+ editContext.operations.editField({
54
+ field: field.descriptor,
55
+ rawValue: JSON.stringify(raw),
56
+ refresh: "waitForQuietPeriod",
57
+ });
58
+ } }, item.id + field.id + item.language + item.version)] })] }));
59
+ }
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.RawEditor = RawEditor;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const inputtextarea_1 = require("primereact/inputtextarea");
7
+ const editContext_1 = require("../client/editContext");
8
+ const react_1 = require("react");
9
+ const use_debounce_1 = require("use-debounce");
10
+ function RawEditor({ field, readOnly, }) {
11
+ const editContext = (0, editContext_1.useEditContext)();
12
+ const inputRef = (0, react_1.useRef)(null);
13
+ if (!editContext)
14
+ return;
15
+ const [value, setValue] = (0, react_1.useState)(field.rawValue);
16
+ (0, react_1.useEffect)(() => {
17
+ if (inputRef.current !== document.activeElement)
18
+ setValue(field.rawValue);
19
+ }, [field.rawValue]);
20
+ const debouncedSetFieldvalue = (0, use_debounce_1.useDebouncedCallback)((value) => {
21
+ editContext.operations.editField({
22
+ field: field.descriptor,
23
+ rawValue: value,
24
+ refresh: "waitForQuietPeriod",
25
+ });
26
+ }, 200);
27
+ const fieldItem = field.descriptor.item;
28
+ return ((0, jsx_runtime_1.jsx)(inputtextarea_1.InputTextarea, { ref: inputRef, value: value || "", disabled: readOnly, className: "p-2 focus-shadow text-sm", style: { width: "100%" }, rows: 12, onChange: (e) => {
29
+ setValue(e.target.value);
30
+ debouncedSetFieldvalue(e.target.value);
31
+ // field.value = e.target.value;
32
+ } }, fieldItem.id + field.id + fieldItem.language + fieldItem.version));
33
+ }
@@ -0,0 +1,366 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ReactQuill = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ /*
9
+ React-Quill
10
+ https://github.com/zenoamaro/react-quill
11
+ */
12
+ const react_1 = __importDefault(require("react"));
13
+ const isEqual_1 = __importDefault(require("lodash/isEqual"));
14
+ const quill_1 = __importDefault(require("quill"));
15
+ class ReactQuill extends react_1.default.Component {
16
+ constructor(props) {
17
+ super(props);
18
+ /*
19
+ Changing one of these props should cause a full re-render and a
20
+ re-instantiation of the Quill editor.
21
+ */
22
+ this.dirtyProps = [
23
+ "modules",
24
+ "formats",
25
+ "bounds",
26
+ "theme",
27
+ "children",
28
+ ];
29
+ /*
30
+ Changing one of these props should cause a regular update. These are mostly
31
+ props that act on the container, rather than the quillized editing area.
32
+ */
33
+ this.cleanProps = [
34
+ "id",
35
+ "className",
36
+ "style",
37
+ "placeholder",
38
+ "tabIndex",
39
+ "onChange",
40
+ "onChangeSelection",
41
+ "onFocus",
42
+ "onBlur",
43
+ "onKeyPress",
44
+ "onKeyDown",
45
+ "onKeyUp",
46
+ ];
47
+ this.state = {
48
+ generation: 0,
49
+ };
50
+ /*
51
+ Tracks the internal selection of the Quill editor
52
+ */
53
+ this.selection = null;
54
+ this.editingAreaRef = react_1.default.createRef();
55
+ this.onEditorChange = (eventName, rangeOrDelta,
56
+ //oldRangeOrDelta: Range | DeltaStatic,
57
+ source) => {
58
+ if (eventName === "text-change") {
59
+ this.onEditorChangeText?.(this.editor.root.innerHTML, rangeOrDelta, source, this.unprivilegedEditor);
60
+ }
61
+ else if (eventName === "selection-change") {
62
+ this.onEditorChangeSelection?.(rangeOrDelta, source, this.unprivilegedEditor);
63
+ }
64
+ };
65
+ const value = this.isControlled() ? props.value : props.defaultValue;
66
+ this.value = value ?? "";
67
+ }
68
+ validateProps(props) {
69
+ if (react_1.default.Children.count(props.children) > 1)
70
+ throw new Error("The Quill editing area can only be composed of a single React element.");
71
+ if (react_1.default.Children.count(props.children)) {
72
+ const child = react_1.default.Children.only(props.children);
73
+ if (child?.type === "textarea")
74
+ throw new Error("Quill does not support editing on a <textarea>. Use a <div> instead.");
75
+ }
76
+ if (this.lastDeltaChangeSet && props.value === this.lastDeltaChangeSet)
77
+ throw new Error("You are passing the `delta` object from the `onChange` event back " +
78
+ "as `value`. You most probably want `editor.getContents()` instead. " +
79
+ "See: https://github.com/zenoamaro/react-quill#using-deltas");
80
+ }
81
+ shouldComponentUpdate(nextProps, nextState) {
82
+ this.validateProps(nextProps);
83
+ // If the editor hasn't been instantiated yet, or the component has been
84
+ // regenerated, we already know we should update.
85
+ if (!this.editor || this.state.generation !== nextState.generation) {
86
+ return true;
87
+ }
88
+ // Handle value changes in-place
89
+ if ("value" in nextProps) {
90
+ const prevContents = this.getEditorContents();
91
+ const nextContents = nextProps.value ?? "";
92
+ // NOTE: Seeing that Quill is missing a way to prevent edits, we have to
93
+ // settle for a hybrid between controlled and uncontrolled mode. We
94
+ // can't prevent the change, but we'll still override content
95
+ // whenever `value` differs from current state.
96
+ // NOTE: Comparing an HTML string and a Quill Delta will always trigger a
97
+ // change, regardless of whether they represent the same document.
98
+ if (!this.isEqualValue(nextContents, prevContents)) {
99
+ this.setEditorContents(this.editor, nextContents);
100
+ }
101
+ }
102
+ // Handle read-only changes in-place
103
+ if (nextProps.readOnly !== this.props.readOnly) {
104
+ this.setEditorReadOnly(this.editor, nextProps.readOnly);
105
+ }
106
+ // Clean and Dirty props require a render
107
+ return [...this.cleanProps, ...this.dirtyProps].some((prop) => {
108
+ return !(0, isEqual_1.default)(nextProps[prop], this.props[prop]);
109
+ });
110
+ }
111
+ shouldComponentRegenerate(nextProps) {
112
+ // Whenever a `dirtyProp` changes, the editor needs reinstantiation.
113
+ return this.dirtyProps.some((prop) => {
114
+ return !(0, isEqual_1.default)(nextProps[prop], this.props[prop]);
115
+ });
116
+ }
117
+ componentDidMount() {
118
+ this.instantiateEditor();
119
+ this.setEditorContents(this.editor, this.getEditorContents());
120
+ }
121
+ componentWillUnmount() {
122
+ this.destroyEditor();
123
+ }
124
+ componentDidUpdate(prevProps, prevState) {
125
+ // If we're changing one of the `dirtyProps`, the entire Quill Editor needs
126
+ // to be re-instantiated. Regenerating the editor will cause the whole tree,
127
+ // including the container, to be cleaned up and re-rendered from scratch.
128
+ // Store the contents so they can be restored later.
129
+ if (this.editor && this.shouldComponentRegenerate(prevProps)) {
130
+ const delta = this.editor.getContents();
131
+ const selection = this.editor.getSelection();
132
+ this.regenerationSnapshot = { delta, selection };
133
+ this.setState({ generation: this.state.generation + 1 });
134
+ this.destroyEditor();
135
+ }
136
+ // The component has been regenerated, so it must be re-instantiated, and
137
+ // its content must be restored to the previous values from the snapshot.
138
+ if (this.state.generation !== prevState.generation) {
139
+ const { delta, selection } = this.regenerationSnapshot;
140
+ delete this.regenerationSnapshot;
141
+ this.instantiateEditor();
142
+ const editor = this.editor;
143
+ editor.setContents(delta);
144
+ postpone(() => this.setEditorSelection(editor, selection));
145
+ }
146
+ }
147
+ instantiateEditor() {
148
+ if (this.editor) {
149
+ this.hookEditor(this.editor);
150
+ }
151
+ else {
152
+ this.editor = this.createEditor(this.getEditingArea(), this.getEditorConfig());
153
+ }
154
+ }
155
+ destroyEditor() {
156
+ if (!this.editor)
157
+ return;
158
+ this.unhookEditor(this.editor);
159
+ }
160
+ /*
161
+ We consider the component to be controlled if `value` is being sent in props.
162
+ */
163
+ isControlled() {
164
+ return "value" in this.props;
165
+ }
166
+ getEditorConfig() {
167
+ return {
168
+ bounds: this.props.bounds,
169
+ formats: this.props.formats,
170
+ modules: this.props.modules,
171
+ placeholder: this.props.placeholder,
172
+ readOnly: this.props.readOnly,
173
+ scrollingContainer: this.props.scrollingContainer,
174
+ tabIndex: this.props.tabIndex,
175
+ theme: this.props.theme,
176
+ };
177
+ }
178
+ getEditor() {
179
+ if (!this.editor)
180
+ throw new Error("Accessing non-instantiated editor");
181
+ return this.editor;
182
+ }
183
+ /**
184
+ Creates an editor on the given element. The editor will be passed the
185
+ configuration, have its events bound,
186
+ */
187
+ createEditor(element, config) {
188
+ const editor = new quill_1.default(element, config);
189
+ if (config.tabIndex != null) {
190
+ this.setEditorTabIndex(editor, config.tabIndex);
191
+ }
192
+ this.hookEditor(editor);
193
+ return editor;
194
+ }
195
+ hookEditor(editor) {
196
+ // Expose the editor on change events via a weaker, unprivileged proxy
197
+ // object that does not allow accidentally modifying editor state.
198
+ this.unprivilegedEditor = this.makeUnprivilegedEditor(editor);
199
+ // Using `editor-change` allows picking up silent updates, like selection
200
+ // changes on typing.
201
+ editor.on("editor-change", this.onEditorChange);
202
+ }
203
+ unhookEditor(editor) {
204
+ editor.off("editor-change", this.onEditorChange);
205
+ }
206
+ getEditorContents() {
207
+ return this.value;
208
+ }
209
+ getEditorSelection() {
210
+ return this.selection;
211
+ }
212
+ /*
213
+ True if the value is a Delta instance or a Delta look-alike.
214
+ */
215
+ isDelta(value) {
216
+ return value && value.ops;
217
+ }
218
+ /*
219
+ Special comparison function that knows how to compare Deltas.
220
+ */
221
+ isEqualValue(value, nextValue) {
222
+ if (this.isDelta(value) && this.isDelta(nextValue)) {
223
+ return (0, isEqual_1.default)(value.ops, nextValue.ops);
224
+ }
225
+ else {
226
+ return (0, isEqual_1.default)(value, nextValue);
227
+ }
228
+ }
229
+ /*
230
+ Replace the contents of the editor, but keep the previous selection hanging
231
+ around so that the cursor won't move.
232
+ */
233
+ setEditorContents(editor, value) {
234
+ this.value = value;
235
+ //const sel = this.getEditorSelection();
236
+ if (typeof value === "string") {
237
+ editor.setContents(editor.clipboard.convert({ html: value }));
238
+ }
239
+ else {
240
+ editor.setContents(value);
241
+ }
242
+ // THIS STEALS FOCUS!
243
+ // postpone(() => this.setEditorSelection(editor, sel));
244
+ }
245
+ setEditorSelection(editor, range) {
246
+ this.selection = range;
247
+ if (range) {
248
+ // Validate bounds before applying.
249
+ const length = editor.getLength();
250
+ range.index = Math.max(0, Math.min(range.index, length - 1));
251
+ range.length = Math.max(0, Math.min(range.length, length - 1 - range.index));
252
+ editor.setSelection(range);
253
+ }
254
+ }
255
+ setEditorTabIndex(editor, tabIndex) {
256
+ if (editor?.scroll?.domNode) {
257
+ editor.scroll.domNode.tabIndex = tabIndex;
258
+ }
259
+ }
260
+ setEditorReadOnly(editor, value) {
261
+ if (value) {
262
+ editor.disable();
263
+ }
264
+ else {
265
+ editor.enable();
266
+ }
267
+ }
268
+ /*
269
+ Returns a weaker, unprivileged proxy object that only exposes read-only
270
+ accessors found on the editor instance, without any state-modifying methods.
271
+ */
272
+ makeUnprivilegedEditor(editor) {
273
+ const e = editor;
274
+ return {
275
+ getHTML: () => e.root.innerHTML,
276
+ getLength: e.getLength.bind(e),
277
+ getText: e.getText.bind(e),
278
+ getContents: e.getContents.bind(e),
279
+ getSelection: e.getSelection.bind(e),
280
+ getBounds: e.getBounds.bind(e),
281
+ };
282
+ }
283
+ getEditingArea() {
284
+ if (!this.editingAreaRef.current) {
285
+ throw new Error("Editing area is not available");
286
+ }
287
+ return this.editingAreaRef.current;
288
+ }
289
+ /*
290
+ Renders an editor area, unless it has been provided one to clone.
291
+ */
292
+ renderEditingArea() {
293
+ const { children, preserveWhitespace } = this.props;
294
+ const { generation } = this.state;
295
+ if (react_1.default.Children.count(children)) {
296
+ return react_1.default.cloneElement(react_1.default.Children.only(children), {
297
+ ref: this.editingAreaRef,
298
+ });
299
+ }
300
+ return preserveWhitespace ? ((0, jsx_runtime_1.jsx)("pre", { ref: this.editingAreaRef }, generation)) : ((0, jsx_runtime_1.jsx)("div", { ref: this.editingAreaRef }, generation));
301
+ }
302
+ render() {
303
+ return ((0, jsx_runtime_1.jsx)("div", { id: this.props.id, style: this.props.style, className: `quill ${this.props.className ?? ""}`, onKeyPress: this.props.onKeyPress, onKeyDownCapture: this.props.onKeyDown, onKeyUp: this.props.onKeyUp, children: this.renderEditingArea() }, this.state.generation));
304
+ }
305
+ onEditorChangeText(value, delta, source, editor) {
306
+ if (!this.editor)
307
+ return;
308
+ // We keep storing the same type of value as what the user gives us,
309
+ // so that value comparisons will be more stable and predictable.
310
+ const nextContents = this.isDelta(this.value)
311
+ ? editor.getContents()
312
+ : editor.getHTML();
313
+ if (nextContents !== this.getEditorContents()) {
314
+ // Taint this `delta` object, so we can recognize whether the user
315
+ // is trying to send it back as `value`, preventing a likely loop.
316
+ this.lastDeltaChangeSet = delta;
317
+ this.value = nextContents;
318
+ this.props.onChange?.(value, delta, source, editor);
319
+ }
320
+ }
321
+ onEditorChangeSelection(nextSelection, source, editor) {
322
+ if (!this.editor)
323
+ return;
324
+ const currentSelection = this.getEditorSelection();
325
+ const hasGainedFocus = !currentSelection && nextSelection;
326
+ const hasLostFocus = currentSelection && !nextSelection;
327
+ if ((0, isEqual_1.default)(nextSelection, currentSelection))
328
+ return;
329
+ this.selection = nextSelection;
330
+ this.props.onChangeSelection?.(nextSelection, source, editor);
331
+ if (hasGainedFocus) {
332
+ this.props.onFocus?.(nextSelection, source, editor);
333
+ }
334
+ else if (hasLostFocus) {
335
+ this.props.onBlur?.(currentSelection, source, editor);
336
+ }
337
+ }
338
+ focus() {
339
+ if (!this.editor)
340
+ return;
341
+ this.editor.focus();
342
+ }
343
+ blur() {
344
+ if (!this.editor)
345
+ return;
346
+ this.selection = null;
347
+ this.editor.blur();
348
+ }
349
+ }
350
+ exports.ReactQuill = ReactQuill;
351
+ ReactQuill.displayName = "React Quill";
352
+ /*
353
+ Export Quill to be able to call `register`
354
+ */
355
+ ReactQuill.Quill = quill_1.default;
356
+ ReactQuill.defaultProps = {
357
+ theme: "snow",
358
+ modules: {},
359
+ readOnly: false,
360
+ };
361
+ /*
362
+ Small helper to execute a function in the next micro-tick.
363
+ */
364
+ function postpone(fn) {
365
+ Promise.resolve().then(fn);
366
+ }
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.RichTextEditor = RichTextEditor;
41
+ const jsx_runtime_1 = require("react/jsx-runtime");
42
+ const dynamic_1 = __importDefault(require("next/dynamic"));
43
+ const RichTextEditorComponent = (0, dynamic_1.default)(() => Promise.resolve().then(() => __importStar(require("./RichTextEditorComponent"))).then((dnd) => dnd.RichTextEditorComponent), { ssr: false });
44
+ function RichTextEditor({ field, readOnly, }) {
45
+ return (0, jsx_runtime_1.jsx)(RichTextEditorComponent, { field: field, readOnly: readOnly });
46
+ }
@@ -0,0 +1,72 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.RichTextEditorComponent = RichTextEditorComponent;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const editContext_1 = require("../client/editContext");
7
+ const use_debounce_1 = require("use-debounce");
8
+ const react_1 = require("react");
9
+ const ReactQuill_1 = require("./ReactQuill");
10
+ require("react-quill-new/dist/quill.snow.css");
11
+ const utils_1 = require("primereact/utils");
12
+ function RichTextEditorComponent({ field, readOnly, }) {
13
+ const editContextRef = (0, editContext_1.useEditContextRef)();
14
+ const modifiedFieldsContext = (0, editContext_1.useModifiedFieldsContext)();
15
+ const state = (0, react_1.useRef)({ focus: false });
16
+ const inputRef = (0, react_1.useRef)(null);
17
+ if (!editContextRef.current)
18
+ return;
19
+ const [value, setValue] = (0, react_1.useState)(field.value);
20
+ const fieldItem = field.descriptor.item;
21
+ if (!fieldItem)
22
+ return;
23
+ const modifiedField = modifiedFieldsContext?.modifiedFields.find((x) => x.fieldId === field.id &&
24
+ x.item.id === fieldItem.id &&
25
+ x.item.language === fieldItem.language &&
26
+ x.item.version === fieldItem.version);
27
+ (0, react_1.useEffect)(() => {
28
+ if (!state.current.focus ||
29
+ !document.activeElement?.classList.contains("ql-editor")) {
30
+ if (field.isHistoric)
31
+ setValue(field.value);
32
+ else
33
+ setValue(modifiedField?.value ?? field.value);
34
+ }
35
+ }, [field.value, modifiedFieldsContext?.modifiedFields]);
36
+ const debouncedSetFieldvalue = (0, use_debounce_1.useThrottledCallback)((value) => {
37
+ editContextRef.current?.operations.editField({
38
+ field: field.descriptor,
39
+ value: value,
40
+ refresh: "none",
41
+ });
42
+ }, editContextRef.current?.configuration.debounceFieldEditsInterval);
43
+ const handleChange = (newValue) => {
44
+ if (newValue === "<p><br></p>" && !field.value)
45
+ return;
46
+ if (newValue !== value && state.current.focus && !readOnly) {
47
+ setValue(newValue);
48
+ debouncedSetFieldvalue(newValue);
49
+ }
50
+ };
51
+ return (
52
+ // Primereact 10.6.6: - Editor takes focus on value change
53
+ // <Editor
54
+ // className="focus-shadow"
55
+ // key={fieldItem.id + field.id + fieldItem.language + fieldItem.version}
56
+ // disabled={readOnly}
57
+ // value={value}
58
+ // style={{ width: "100%" }}
59
+ // // onTextChange={(e) => {
60
+ // // const val = e.htmlValue ?? "";
61
+ // // setValue(val);
62
+ // // debouncedSetFieldvalue(val);
63
+ // // }}
64
+ // />
65
+ (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.classNames)(readOnly ? "bg-gray-100" : "bg-white", "focus-shadow"), children: (0, jsx_runtime_1.jsx)(ReactQuill_1.ReactQuill, { ref: inputRef, theme: "snow", value: value, onChange: handleChange, onFocus: () => {
66
+ setTimeout(() => {
67
+ state.current.focus = true;
68
+ }, 101);
69
+ }, onBlur: () => {
70
+ state.current.focus = false;
71
+ }, readOnly: readOnly }) }));
72
+ }