@yimingliao/cms 0.0.145 → 0.0.146

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 (97) hide show
  1. package/dist/export/client/index.js +1 -71
  2. package/dist/src/client/interfaces/components/shadcn/sidebar.js +1 -1
  3. package/dist/src/client/interfaces/styles/constants.js +1 -3
  4. package/dist/types/export/client/components/index.d.ts +2 -0
  5. package/dist/types/export/client/components/index.d.ts.map +1 -0
  6. package/dist/types/export/client/index.d.ts +1 -1
  7. package/dist/types/export/client/index.d.ts.map +1 -1
  8. package/dist/types/src/client/index.d.ts +1 -1
  9. package/dist/types/src/client/index.d.ts.map +1 -1
  10. package/dist/types/src/client/interfaces/index.d.ts +0 -2
  11. package/dist/types/src/client/interfaces/index.d.ts.map +1 -1
  12. package/package.json +6 -1
  13. package/dist/src/client/applications/ui/use-parent-pathname.js +0 -10
  14. package/dist/src/client/interfaces/components/admin-initializer.js +0 -29
  15. package/dist/src/client/interfaces/components/resources/file/file-card.js +0 -87
  16. package/dist/src/client/interfaces/components/resources/file/file-list.js +0 -159
  17. package/dist/src/client/interfaces/components/resources/file/is-locked-buttons.js +0 -71
  18. package/dist/src/client/interfaces/components/resources/file/type-buttons.js +0 -62
  19. package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/list-cards-container.js +0 -96
  20. package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/page-size-selector.js +0 -63
  21. package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/pagination.js +0 -94
  22. package/dist/src/client/interfaces/components/ui/blocks/page-header/page-header-title.js +0 -26
  23. package/dist/src/client/interfaces/components/ui/blocks/page-header/page-header.js +0 -74
  24. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/batch-create.js +0 -33
  25. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/batch.js +0 -39
  26. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/create.js +0 -33
  27. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/edit.js +0 -33
  28. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/index.js +0 -48
  29. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/show.js +0 -61
  30. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/trash.js +0 -39
  31. package/dist/src/client/interfaces/components/ui/buttons/return-button.js +0 -61
  32. package/dist/src/client/interfaces/components/ui/cards/action-buttons-card.js +0 -82
  33. package/dist/src/client/interfaces/components/ui/cards/resource-card/card-status-bar.js +0 -51
  34. package/dist/src/client/interfaces/components/ui/cards/resource-card/card-text-content.js +0 -38
  35. package/dist/src/client/interfaces/components/ui/cards/resource-card/resource-card.js +0 -77
  36. package/dist/src/client/interfaces/components/ui/display/array-list.js +0 -69
  37. package/dist/src/client/interfaces/components/ui/display/badge.js +0 -41
  38. package/dist/src/client/interfaces/components/ui/display/html-display.js +0 -32
  39. package/dist/src/client/interfaces/components/ui/display/object-array-list.js +0 -75
  40. package/dist/src/client/interfaces/components/ui/features/accordion/accordion-container.js +0 -31
  41. package/dist/src/client/interfaces/components/ui/features/accordion/accordion-header.js +0 -34
  42. package/dist/src/client/interfaces/components/ui/features/accordion/accordion.js +0 -81
  43. package/dist/src/client/interfaces/components/ui/features/expandable-list/expand-bar.js +0 -39
  44. package/dist/src/client/interfaces/components/ui/features/expandable-list/expandable-list-content.js +0 -49
  45. package/dist/src/client/interfaces/components/ui/features/expandable-list/expandable-list.js +0 -53
  46. package/dist/src/client/interfaces/components/ui/features/external-link.js +0 -15
  47. package/dist/src/client/interfaces/components/ui/features/file/file-info/file-info.js +0 -118
  48. package/dist/src/client/interfaces/components/ui/features/file/file-info/file-name.js +0 -48
  49. package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker-container.js +0 -74
  50. package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker-placeholder.js +0 -48
  51. package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker.js +0 -109
  52. package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview-list.js +0 -85
  53. package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview-meta.js +0 -40
  54. package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview.js +0 -113
  55. package/dist/src/client/interfaces/components/ui/features/file/uploader.js +0 -101
  56. package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal-body.js +0 -112
  57. package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal-trigger.js +0 -97
  58. package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal.js +0 -77
  59. package/dist/src/client/interfaces/components/ui/features/smart-image.js +0 -57
  60. package/dist/src/client/interfaces/components/ui/features/tick.js +0 -27
  61. package/dist/src/client/interfaces/components/ui/form/containers/fields-container.js +0 -24
  62. package/dist/src/client/interfaces/components/ui/form/containers/main-fields.js +0 -25
  63. package/dist/src/client/interfaces/components/ui/form/containers/side-fields.js +0 -24
  64. package/dist/src/client/interfaces/components/ui/form/control-fields/built-in-fields.js +0 -9
  65. package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields-display.js +0 -112
  66. package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields-input.js +0 -158
  67. package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields.js +0 -59
  68. package/dist/src/client/interfaces/components/ui/form/field-body.js +0 -79
  69. package/dist/src/client/interfaces/components/ui/form/index-field.js +0 -87
  70. package/dist/src/client/interfaces/components/ui/form/slug-field.js +0 -82
  71. package/dist/src/client/interfaces/components/ui/inputs/array-input.js +0 -110
  72. package/dist/src/client/interfaces/components/ui/inputs/checkbox.js +0 -93
  73. package/dist/src/client/interfaces/components/ui/inputs/editor/base/base-editor.js +0 -143
  74. package/dist/src/client/interfaces/components/ui/inputs/editor/base/built-in-plugins.js +0 -71
  75. package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/heading.config.js +0 -41
  76. package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/image.config.js +0 -32
  77. package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/table.config.js +0 -15
  78. package/dist/src/client/interfaces/components/ui/inputs/editor/editor.js +0 -112
  79. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/asset-manager/asset-manager.js +0 -24
  80. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/asset-manager/use-control-asset-mamager.js +0 -26
  81. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/file-repository/upload-adapter.js +0 -84
  82. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/word-count-display/icons.js +0 -17
  83. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/word-count-display/word-count-display.js +0 -81
  84. package/dist/src/client/interfaces/components/ui/inputs/editor/use-init-editor/use-init-editor.js +0 -50
  85. package/dist/src/client/interfaces/components/ui/inputs/search-input.js +0 -61
  86. package/dist/src/client/interfaces/components/ui/inputs/select.js +0 -69
  87. package/dist/src/client/interfaces/components/ui/inputs/textarea.js +0 -62
  88. package/dist/src/client/interfaces/components/ui/layouts/content-container.js +0 -38
  89. package/dist/src/client/interfaces/components/ui/layouts/navbar/i18n-selector.js +0 -42
  90. package/dist/src/client/interfaces/components/ui/layouts/navbar/nav-user.js +0 -106
  91. package/dist/src/client/interfaces/components/ui/layouts/navbar/navbar.js +0 -84
  92. package/dist/src/client/interfaces/components/ui/layouts/navbar/sign-out-button.js +0 -58
  93. package/dist/src/client/interfaces/components/ui/layouts/navbar/theme-selector.js +0 -51
  94. package/dist/src/client/interfaces/components/ui/layouts/sidebar/nav-main.js +0 -99
  95. package/dist/src/constants/file.js +0 -27
  96. package/dist/src/shared/list-items.js +0 -3
  97. package/dist/src/shared/utils/debounce.js +0 -14
@@ -1,110 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from 'react/jsx-runtime';
3
- import { CircleX, CirclePlus } from 'lucide-react';
4
- import 'react';
5
- import 'ua-parser-js';
6
- import { cn } from '../../../../applications/shadcn/utils.js';
7
- import 'next/navigation';
8
- import '@radix-ui/react-avatar';
9
- import '../../shadcn/badge.js';
10
- import '../../shadcn/button.js';
11
- import '@radix-ui/react-collapsible';
12
- import '@radix-ui/react-dialog';
13
- import '@radix-ui/react-dropdown-menu';
14
- import '../../shadcn/input-group.js';
15
- import '@radix-ui/react-label';
16
- import '@radix-ui/react-select';
17
- import { Separator } from '../../shadcn/separator.js';
18
- import '../../shadcn/sidebar.js';
19
- import '@radix-ui/react-tooltip';
20
- import { Button } from '../buttons/button.js';
21
- import 'intor/react';
22
- import { Textarea } from './textarea.js';
23
-
24
- function ArrayInput({
25
- // form context
26
- formData,
27
- fieldName,
28
- setFormData,
29
- // ui states
30
- isLoading = false,
31
- isDisabled = false,
32
- isResizable = false,
33
- errors,
34
- // base
35
- placeholder = "",
36
- ...props
37
- }) {
38
- isDisabled = isDisabled || isLoading;
39
- const rawValue = formData?.[fieldName ?? ""];
40
- const values = Array.isArray(rawValue) && rawValue.length > 0 ? rawValue.map(String) : [""];
41
- const errorIndexes = new Set(
42
- errors.filter((e) => e.startsWith(fieldName ?? "")).map((e) => e.split(".").pop()).map(Number)
43
- );
44
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: values.map((value, index) => {
45
- const isError = errorIndexes.has(index);
46
- return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
47
- /* @__PURE__ */ jsxs("div", { className: "flex-center absolute top-0 left-0 z-10 h-full", children: [
48
- /* @__PURE__ */ jsx("span", { className: "min-w-10 pl-0.5 text-center text-sm opacity-50", children: Array.isArray(rawValue) && rawValue.length === 0 ? "0" : index + 1 }),
49
- /* @__PURE__ */ jsx(Separator, { orientation: "vertical" })
50
- ] }),
51
- /* @__PURE__ */ jsx(
52
- Textarea,
53
- {
54
- disabled: isDisabled,
55
- placeholder: isLoading ? "" : placeholder,
56
- value,
57
- onChange: (e) => {
58
- if (!setFormData || !fieldName) return;
59
- const copy = [...values];
60
- copy[index] = e.target.value;
61
- setFormData((p) => ({ ...p, [fieldName]: copy }));
62
- },
63
- onKeyDown: (e) => {
64
- if (e.key === "Enter" && !isResizable) {
65
- e.preventDefault();
66
- }
67
- },
68
- isError,
69
- className: cn("pr-20 pl-13", !isResizable && "resize-none"),
70
- ...props
71
- }
72
- ),
73
- /* @__PURE__ */ jsxs("div", { className: "flex-center absolute top-1 right-1 gap-1", children: [
74
- /* @__PURE__ */ jsx(
75
- Button,
76
- {
77
- variant: "outline",
78
- type: "button",
79
- size: "icon-sm",
80
- className: "rounded-sm",
81
- onClick: () => {
82
- if (!setFormData || !fieldName) return;
83
- const copy = values.filter((_, i) => i !== index);
84
- setFormData((p) => ({ ...p, [fieldName]: copy }));
85
- },
86
- children: /* @__PURE__ */ jsx(CircleX, { className: "text-destructive" })
87
- }
88
- ),
89
- /* @__PURE__ */ jsx(
90
- Button,
91
- {
92
- variant: "outline",
93
- type: "button",
94
- size: "icon-sm",
95
- className: "rounded-sm",
96
- onClick: () => {
97
- if (!setFormData || !fieldName) return;
98
- const copy = [...values];
99
- copy.splice(index + 1, 0, "");
100
- setFormData((p) => ({ ...p, [fieldName]: copy }));
101
- },
102
- children: /* @__PURE__ */ jsx(CirclePlus, { className: "text-success" })
103
- }
104
- )
105
- ] })
106
- ] }, index);
107
- }) });
108
- }
109
-
110
- export { ArrayInput };
@@ -1,93 +0,0 @@
1
- "use client";
2
- import { jsxs, jsx } from 'react/jsx-runtime';
3
- import 'react';
4
- import 'ua-parser-js';
5
- import { cn } from '../../../../applications/shadcn/utils.js';
6
- import 'next/navigation';
7
- import '@radix-ui/react-avatar';
8
- import '../../shadcn/badge.js';
9
- import '../../shadcn/button.js';
10
- import '@radix-ui/react-collapsible';
11
- import '@radix-ui/react-dialog';
12
- import 'lucide-react';
13
- import '@radix-ui/react-dropdown-menu';
14
- import '../../shadcn/input-group.js';
15
- import '@radix-ui/react-label';
16
- import '@radix-ui/react-select';
17
- import '@radix-ui/react-separator';
18
- import '../../shadcn/sidebar.js';
19
- import { Spinner } from '../../shadcn/spinner.js';
20
- import '@radix-ui/react-tooltip';
21
-
22
- function Checkbox({
23
- // form context
24
- fieldName,
25
- formData,
26
- setFormData,
27
- // ui states
28
- isLoading = false,
29
- isDisabled = false,
30
- // base
31
- isDisplay = false,
32
- className = "",
33
- ...props
34
- }) {
35
- isDisabled = isDisabled || isLoading || isDisplay;
36
- const isChecked = !!formData?.[fieldName ?? ""];
37
- return /* @__PURE__ */ jsxs(
38
- "div",
39
- {
40
- className: cn(
41
- className,
42
- "group relative",
43
- "h-6 w-12 min-w-12",
44
- "p-1",
45
- "rounded-full",
46
- "overflow-hidden",
47
- "shadow-inner",
48
- !isChecked || isLoading ? "bg-secondary" : "bg-success",
49
- "transition"
50
- ),
51
- children: [
52
- /* @__PURE__ */ jsx(
53
- "div",
54
- {
55
- className: cn(
56
- "size-4",
57
- "rounded-full",
58
- "bg-white",
59
- "shadow",
60
- isChecked && "translate-x-6",
61
- isLoading && "opacity-0",
62
- !isDisabled && "group-hover:scale-95 group-active:scale-90",
63
- "duration-200"
64
- )
65
- }
66
- ),
67
- isLoading && /* @__PURE__ */ jsx("span", { className: "absolute top-1 left-1", children: /* @__PURE__ */ jsx(Spinner, {}) }),
68
- /* @__PURE__ */ jsx(
69
- "input",
70
- {
71
- type: "checkbox",
72
- onChange: (e) => {
73
- if (!setFormData || !fieldName) return;
74
- setFormData((p) => ({ ...p, [fieldName]: e.target.checked }));
75
- },
76
- checked: isChecked,
77
- disabled: isDisabled,
78
- className: cn(
79
- "absolute top-0 left-0",
80
- "h-full w-full",
81
- "rounded-full",
82
- "opacity-0",
83
- isDisabled ? "cursor-not-allowed" : "cursor-pointer"
84
- ),
85
- ...props
86
- }
87
- )
88
- ]
89
- }
90
- );
91
- }
92
-
93
- export { Checkbox };
@@ -1,143 +0,0 @@
1
- import { ClassicEditor } from 'ckeditor5';
2
- import enTranslations from 'ckeditor5/translations/en.js';
3
- import zhTranslations from 'ckeditor5/translations/zh.js';
4
- import { ASSET_MANAGER_PLUGIN_NAME } from '../plugins/asset-manager/asset-manager.js';
5
- import 'intor/react';
6
- import 'react';
7
- import 'mime-types';
8
- import { WORD_COUNT_DISPLAY_PLUGIN_NAME } from '../plugins/word-count-display/word-count-display.js';
9
- import { builtinPlugins } from './built-in-plugins.js';
10
- import { headingConfig } from './configs/heading.config.js';
11
- import { tableConfig } from './configs/table.config.js';
12
- import { imageConfig } from './configs/image.config.js';
13
-
14
- class BaseEditor extends ClassicEditor {
15
- static builtinPlugins = builtinPlugins;
16
- static defaultConfig = {
17
- licenseKey: "GPL",
18
- //====== Translations ======
19
- translations: [zhTranslations, enTranslations],
20
- // schema: { allowIn: ["figure"], allowAttributes: ["src"] },
21
- //====== Toolbar ======
22
- toolbar: {
23
- items: [
24
- //------ 1 row ------
25
- "undo",
26
- // [Undo]
27
- "redo",
28
- // [Undo]
29
- "|",
30
- "heading",
31
- // [Heading]
32
- "fontFamily",
33
- // [Font]
34
- "fontSize",
35
- // [Font]
36
- "fontColor",
37
- // [Font]
38
- "fontBackgroundColor",
39
- // [Font]
40
- "highlight",
41
- // [Highlight]
42
- "|",
43
- "emoji",
44
- // [Emoji]
45
- "specialCharacters",
46
- // [SpecialCharacters]
47
- "|",
48
- "removeFormat",
49
- // [RemoveFormat]
50
- "|",
51
- "selectAll",
52
- // [SelectAll]
53
- "findAndReplace",
54
- // [FindAndReplace]
55
- "-",
56
- //------ 2 row ------
57
- "alignment",
58
- // [Alignment]
59
- "indent",
60
- // [Indent]
61
- "outdent",
62
- // [Indent]
63
- "|",
64
- "bold",
65
- // [Bold]
66
- "italic",
67
- // [Italic]
68
- "strikethrough",
69
- // [Strikethrough]
70
- "underline",
71
- // [Underline]
72
- "subscript",
73
- // [Subscript]
74
- "superscript",
75
- // [Superscript]
76
- "code",
77
- // [Code]
78
- "link",
79
- // [Link]
80
- "|",
81
- ASSET_MANAGER_PLUGIN_NAME,
82
- "insertImage",
83
- // [Image]
84
- "mediaEmbed",
85
- // [MediaEmbed]
86
- "|",
87
- "codeBlock",
88
- // [CodeBlock]
89
- "htmlEmbed",
90
- // [HtmlEmbed]
91
- //------ 3 row ------
92
- "-",
93
- "bulletedList",
94
- // [List]
95
- "numberedList",
96
- // [List]
97
- "todoList",
98
- // [TodoList]
99
- "|",
100
- "blockQuote",
101
- // [BlockQuote]
102
- "horizontalLine",
103
- // [HorizontalLine]
104
- "pageBreak",
105
- // [PageBreak]
106
- "|",
107
- "insertTable",
108
- // [Table]
109
- "insertTableLayout",
110
- // [Table]
111
- "|",
112
- "showBlocks",
113
- // [ShowBlocks]
114
- "sourceEditing",
115
- // [SourceEditing]
116
- "|",
117
- //------ Word Count Display ------
118
- WORD_COUNT_DISPLAY_PLUGIN_NAME.html,
119
- WORD_COUNT_DISPLAY_PLUGIN_NAME.characters,
120
- WORD_COUNT_DISPLAY_PLUGIN_NAME.words
121
- ],
122
- shouldNotGroupWhenFull: true
123
- },
124
- //====== Specific Configs ======
125
- heading: headingConfig,
126
- link: { addTargetToExternalLinks: true },
127
- table: tableConfig,
128
- image: imageConfig,
129
- htmlSupport: {
130
- allow: [{ name: /.*/, attributes: true, classes: true, styles: true }]
131
- },
132
- htmlEmbed: { showPreviews: true },
133
- emoji: { skinTone: "light" },
134
- fontFamily: { supportAllValues: false },
135
- fontSize: {
136
- options: [12, 14, "default", 16, 18, 20, 22, 24, 26, 28],
137
- supportAllValues: false
138
- }
139
- // menuBar: { isVisible: true },
140
- };
141
- }
142
-
143
- export { BaseEditor };
@@ -1,71 +0,0 @@
1
- import { Essentials, Paragraph, Autoformat, TextTransformation, Bold, Code, Italic, Strikethrough, Subscript, Superscript, Underline, Indent, IndentBlock, BlockQuote, CodeBlock, Emoji, Mention, FindAndReplace, Font, Heading, Highlight, HorizontalLine, GeneralHtmlSupport, HtmlComment, HtmlEmbed, Image, ImageToolbar, ImageCaption, ImageStyle, ImageResize, LinkImage, ImageInsert, AutoImage, ImageUpload, Link, AutoLink, List, TodoList, MediaEmbed, PageBreak, PasteFromOffice, PasteFromMarkdownExperimental, RemoveFormat, ShowBlocks, SourceEditing, SpecialCharacters, SpecialCharactersEssentials, Table, TableToolbar, TableProperties, TableCellProperties, TableColumnResize, TableCaption, TableLayout, Alignment, WordCount } from 'ckeditor5';
2
- import { AssetManager } from '../plugins/asset-manager/asset-manager.js';
3
- import 'intor/react';
4
- import 'react';
5
- import 'mime-types';
6
- import WordCountButtons from '../plugins/word-count-display/word-count-display.js';
7
-
8
- const builtinPlugins = [
9
- Essentials,
10
- Paragraph,
11
- Autoformat,
12
- // For markdown
13
- TextTransformation,
14
- Bold,
15
- Code,
16
- Italic,
17
- Strikethrough,
18
- Subscript,
19
- Superscript,
20
- Underline,
21
- Indent,
22
- IndentBlock,
23
- BlockQuote,
24
- CodeBlock,
25
- Emoji,
26
- Mention,
27
- FindAndReplace,
28
- Font,
29
- Heading,
30
- Highlight,
31
- HorizontalLine,
32
- GeneralHtmlSupport,
33
- HtmlComment,
34
- HtmlEmbed,
35
- Image,
36
- ImageToolbar,
37
- ImageCaption,
38
- ImageStyle,
39
- ImageResize,
40
- LinkImage,
41
- ImageInsert,
42
- AutoImage,
43
- ImageUpload,
44
- Link,
45
- AutoLink,
46
- List,
47
- TodoList,
48
- MediaEmbed,
49
- PageBreak,
50
- PasteFromOffice,
51
- PasteFromMarkdownExperimental,
52
- RemoveFormat,
53
- ShowBlocks,
54
- SourceEditing,
55
- SpecialCharacters,
56
- SpecialCharactersEssentials,
57
- Table,
58
- TableToolbar,
59
- TableProperties,
60
- TableCellProperties,
61
- TableColumnResize,
62
- TableCaption,
63
- TableLayout,
64
- Alignment,
65
- WordCount,
66
- //====== Custom Plugins ======
67
- AssetManager,
68
- WordCountButtons
69
- ];
70
-
71
- export { builtinPlugins };
@@ -1,41 +0,0 @@
1
- const headingConfig = {
2
- options: [
3
- {
4
- model: "paragraph",
5
- title: "Paragraph",
6
- class: "ck-heading_paragraph"
7
- },
8
- {
9
- model: "heading2",
10
- view: "h2",
11
- title: "Heading 2",
12
- class: "ck-heading_heading2"
13
- },
14
- {
15
- model: "heading3",
16
- view: "h3",
17
- title: "Heading 3",
18
- class: "ck-heading_heading3"
19
- },
20
- {
21
- model: "heading4",
22
- view: "h4",
23
- title: "Heading 4",
24
- class: "ck-heading_heading4"
25
- },
26
- {
27
- model: "heading5",
28
- view: "h5",
29
- title: "Heading 5",
30
- class: "ck-heading_heading5"
31
- },
32
- {
33
- model: "heading6",
34
- view: "h6",
35
- title: "Heading 6",
36
- class: "ck-heading_heading6"
37
- }
38
- ]
39
- };
40
-
41
- export { headingConfig };
@@ -1,32 +0,0 @@
1
- const imageConfig = {
2
- toolbar: [
3
- "toggleImageCaption",
4
- "imageTextAlternative",
5
- "|",
6
- "imageStyle:alignBlockLeft",
7
- "imageStyle:alignCenter",
8
- "imageStyle:alignBlockRight",
9
- "|",
10
- "imageStyle:alignLeft",
11
- "imageStyle:alignRight",
12
- "|",
13
- "imageStyle:inline",
14
- "|",
15
- "resizeImage",
16
- "|",
17
- "linkImage"
18
- ],
19
- resizeOptions: [
20
- { name: "resizeImage:original", label: "Original", value: null },
21
- { name: "resizeImage:custom", label: "Custom", value: "custom" },
22
- { name: "resizeImage:25", label: "25%", value: "25" },
23
- { name: "resizeImage:50", label: "50%", value: "50" },
24
- { name: "resizeImage:75", label: "75%", value: "75" },
25
- { name: "resizeImage:100", label: "100%", value: "100" }
26
- ],
27
- insert: {
28
- integrations: ["upload", "url"]
29
- }
30
- };
31
-
32
- export { imageConfig };
@@ -1,15 +0,0 @@
1
- const tableConfig = {
2
- contentToolbar: [
3
- "toggleTableCaption",
4
- "|",
5
- "tableColumn",
6
- "tableRow",
7
- "|",
8
- "mergeTableCells",
9
- "|",
10
- "tableProperties",
11
- "tableCellProperties"
12
- ]
13
- };
14
-
15
- export { tableConfig };
@@ -1,112 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from 'react/jsx-runtime';
3
- import { useRef } from 'react';
4
- import 'ua-parser-js';
5
- import { cn } from '../../../../../applications/shadcn/utils.js';
6
- import 'next/navigation';
7
- import 'lucide-react';
8
- import 'intor/react';
9
- import '@radix-ui/react-avatar';
10
- import '../../../shadcn/badge.js';
11
- import '../../../shadcn/button.js';
12
- import '@radix-ui/react-collapsible';
13
- import '@radix-ui/react-dialog';
14
- import '@radix-ui/react-dropdown-menu';
15
- import '../../../shadcn/input-group.js';
16
- import '@radix-ui/react-label';
17
- import '@radix-ui/react-select';
18
- import '@radix-ui/react-separator';
19
- import '../../../shadcn/sidebar.js';
20
- import '@radix-ui/react-tooltip';
21
- import 'next/link';
22
- import '../../../../../../constants/paths/auth.js';
23
- import '../../../../../../constants/paths/main.js';
24
- import '../../../../../../constants/paths/resources.js';
25
- import '../../../../../../constants/redirect-paths.js';
26
- import 'mime-types';
27
- import { FieldBody } from '../../form/field-body.js';
28
- import '../../../../../../domain/resources/admin/constants.js';
29
- import { PickModal } from '../../features/pick-modal/pick-modal.js';
30
- import 'next/image';
31
- import 'ckeditor5';
32
- import { useControlAssetManager } from './plugins/asset-manager/use-control-asset-mamager.js';
33
- import { useInitEditor } from './use-init-editor/use-init-editor.js';
34
-
35
- function createEditor({
36
- Uploader,
37
- useCommand,
38
- fileCreateAction,
39
- UploadAdapter,
40
- FileList,
41
- storageUrl,
42
- maxWidth,
43
- queryClient
44
- }) {
45
- return function Editor({
46
- // editor
47
- locale,
48
- value = "",
49
- onEditorChange,
50
- // ui states
51
- isLoading = false,
52
- isDisabled = false,
53
- isError = false,
54
- // base
55
- className = "",
56
- ...props
57
- }) {
58
- const containerRef = useRef(null);
59
- const { execute } = useCommand(
60
- (formData2) => fileCreateAction({ formData: formData2 }),
61
- { clearAll: false }
62
- );
63
- const editorRef = useInitEditor({
64
- enabled: !isLoading,
65
- containerRef,
66
- locale,
67
- value,
68
- onEditorChange,
69
- createUploadAdapter: (loader) => new UploadAdapter(loader, execute, queryClient),
70
- openAssetManager: () => setIsOpenAssetManager(true)
71
- });
72
- const { isOpenAssetManager, setIsOpenAssetManager, formData, setFormData } = useControlAssetManager(editorRef, storageUrl);
73
- return /* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsxs(
74
- FieldBody,
75
- {
76
- className: cn(
77
- className,
78
- "focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",
79
- "shadow-xs transition-[color,box-shadow]",
80
- "rounded-lg",
81
- "border",
82
- isError && "border-destructive focus-within:ring-destructive/50",
83
- "mx-auto"
84
- ),
85
- childrenClassName: "p-0",
86
- style: { maxWidth },
87
- isLoading,
88
- isDisabled: isDisabled || isLoading,
89
- ...props,
90
- children: [
91
- /* @__PURE__ */ jsx("div", { ref: containerRef }),
92
- /* @__PURE__ */ jsx("div", { className: "hidden", children: /* @__PURE__ */ jsx(
93
- PickModal,
94
- {
95
- isOpen: isOpenAssetManager,
96
- setIsOpen: setIsOpenAssetManager,
97
- fieldName: "file",
98
- formData,
99
- setFormData,
100
- isLoading,
101
- isDisabled,
102
- itemList: /* @__PURE__ */ jsx(FileList, {}),
103
- aboveManagementCard: /* @__PURE__ */ jsx(Uploader, { accept: "image/*" })
104
- }
105
- ) })
106
- ]
107
- }
108
- ) });
109
- };
110
- }
111
-
112
- export { createEditor };
@@ -1,24 +0,0 @@
1
- import { Plugin, ButtonView } from 'ckeditor5';
2
-
3
- const ASSET_MANAGER_PLUGIN_NAME = "asset-manager";
4
- const OPEN_ASSET_MANAGER_KEY = "open-asset-manager";
5
- class AssetManager extends Plugin {
6
- init() {
7
- const editor = this.editor;
8
- editor.ui.componentFactory.add(ASSET_MANAGER_PLUGIN_NAME, () => {
9
- const button = new ButtonView();
10
- button.set({
11
- icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M1.201 1c-.662 0-1.2.47-1.2 1.1v14.248c0 .64.533 1.152 1.185 1.152h6.623v-7.236L6.617 9.15a.694.694 0 0 0-.957-.033L1.602 13.55V2.553l14.798.003V9.7H18V2.1c0-.63-.547-1.1-1.2-1.1zm11.723 2.805a2.1 2.1 0 0 0-1.621.832 2.127 2.127 0 0 0 1.136 3.357 2.13 2.13 0 0 0 2.611-1.506 2.13 2.13 0 0 0-.76-2.244 2.13 2.13 0 0 0-1.366-.44Z"/><path d="M19.898 12.369v6.187a.844.844 0 0 1-.844.844h-8.719a.844.844 0 0 1-.843-.844v-7.312a.844.844 0 0 1 .843-.844h2.531a.84.84 0 0 1 .597.248l.838.852h4.75c.223 0 .441.114.6.272a.84.84 0 0 1 .247.597m-1.52.654-4.377.02-1.1-1.143H11v6h7.4l-.023-4.877Z" clip-rule="evenodd"/></svg>`,
12
- label: "Asset Manager",
13
- tooltip: "Select a file from asset manager"
14
- });
15
- button.on("execute", () => {
16
- const openAssetManager = editor.config.get(OPEN_ASSET_MANAGER_KEY);
17
- openAssetManager?.();
18
- });
19
- return button;
20
- });
21
- }
22
- }
23
-
24
- export { ASSET_MANAGER_PLUGIN_NAME, AssetManager, OPEN_ASSET_MANAGER_KEY };
@@ -1,26 +0,0 @@
1
- import { ImageUtils } from 'ckeditor5';
2
- import { useTranslator } from 'intor/react';
3
- import { useState, useEffect } from 'react';
4
- import 'mime-types';
5
- import { findTranslation } from '../../../../../../../../shared/translation/find-translation.js';
6
- import { joinUrl } from '../../../../../../../../shared/utils/join-url.js';
7
-
8
- const useControlAssetManager = (editorRef, storageUrl) => {
9
- const { locale } = useTranslator();
10
- const [isOpenAssetManager, setIsOpenAssetManager] = useState(false);
11
- const [formData, setFormData] = useState({
12
- file: null
13
- });
14
- useEffect(() => {
15
- const { file } = formData;
16
- if (!editorRef.current || !file) return;
17
- const src = joinUrl(storageUrl, `${file.key}?id=${file.id}`);
18
- const alt = findTranslation(file.translations, locale)?.alt ?? "";
19
- const imageUtils = editorRef.current.plugins.get(ImageUtils.pluginName);
20
- imageUtils.insertImage({ src, alt });
21
- queueMicrotask(() => setFormData({ file: null }));
22
- }, [editorRef, formData, locale]);
23
- return { isOpenAssetManager, setIsOpenAssetManager, formData, setFormData };
24
- };
25
-
26
- export { useControlAssetManager };