@peng_kai/kit 0.1.17 → 0.2.0-beta.1
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/admin/adminPlugin.ts +47 -0
- package/admin/components/filter/src/FilterDrawer.vue +153 -153
- package/admin/components/filter/src/FilterParam.vue +76 -78
- package/admin/components/filter/src/FilterReset.vue +2 -2
- package/admin/components/filter/src/useFilterParams.ts +75 -25
- package/admin/components/filter/src/useFilterQuery.ts +32 -16
- package/admin/components/rich-text/index.ts +2 -0
- package/admin/components/rich-text/src/RichText.vue +342 -0
- package/admin/components/rich-text/src/imageUploader.ts +34 -0
- package/admin/components/rich-text/src/type.d.ts +7 -0
- package/admin/components/scroll-nav/index.ts +1 -1
- package/admin/components/scroll-nav/src/ScrollNav.vue +59 -59
- package/admin/components/text/index.ts +13 -13
- package/admin/components/text/src/Amount.vue +121 -121
- package/admin/components/text/src/Datetime.vue +47 -48
- package/admin/components/text/src/Duration.vue +26 -26
- package/admin/components/text/src/Hash.vue +51 -51
- package/admin/components/text/src/createTagGetter.ts +13 -13
- package/admin/components/upload/index.ts +2 -0
- package/admin/components/upload/src/PictureCardUpload.vue +143 -0
- package/admin/components/upload/src/customRequests.ts +31 -0
- package/admin/defines/index.ts +1 -1
- package/admin/defines/route/helpers.ts +0 -1
- package/admin/defines/startup/defineStartup.ts +8 -1
- package/admin/defines/startup/index.ts +1 -1
- package/admin/defines/startup/{getStartups.ts → runStartup.ts} +16 -7
- package/admin/layout/large/Breadcrumb.vue +68 -69
- package/admin/layout/large/Content.vue +23 -24
- package/admin/layout/large/Menu.vue +68 -69
- package/admin/layout/large/PageTab.vue +70 -71
- package/admin/permission/index.ts +2 -4
- package/admin/permission/routerGuard.ts +41 -43
- package/admin/permission/vuePlugin.ts +46 -30
- package/admin/route-guards/collapseMenu.ts +3 -3
- package/admin/route-guards/index.ts +3 -3
- package/admin/route-guards/pageProgress.ts +27 -27
- package/admin/route-guards/pageTitle.ts +18 -19
- package/admin/{hooks/useMenu.ts → stores/createUseMenuStore.ts} +133 -128
- package/admin/{hooks/usePage.ts → stores/createUsePageStore.ts} +145 -141
- package/admin/stores/createUsePageTabStore.ts +43 -0
- package/admin/{permission/usePermission.ts → stores/createUsePermissionStore.ts} +57 -52
- package/admin/stores/index.ts +8 -0
- package/admin/styles/classCover.scss +8 -0
- package/admin/styles/globalCover.scss +54 -54
- package/antd/components/InputNumberRange.vue +59 -59
- package/antd/directives/formLabelAlign.ts +36 -36
- package/antd/hooks/useAntdDrawer.ts +73 -73
- package/antd/hooks/useAntdForm.helpers.ts +92 -8
- package/antd/hooks/useAntdForm.ts +55 -63
- package/antd/hooks/useAntdTable.ts +127 -115
- package/antd/index.ts +1 -1
- package/libs/a-calc.ts +1 -0
- package/libs/axios.ts +2 -0
- package/libs/bignumber.ts +2 -0
- package/libs/dayjs.ts +5 -0
- package/libs/echarts.ts +5 -0
- package/libs/localstorage-slim.ts +2 -0
- package/libs/lodash-es.ts +1 -0
- package/libs/pinia.ts +1 -0
- package/libs/vue-query.ts +1 -0
- package/libs/vueuse.ts +3 -0
- package/package.json +91 -58
- package/request/helpers.ts +68 -49
- package/request/interceptors/toLogin.ts +26 -26
- package/request/queryClient.ts +34 -21
- package/request/type.d.ts +92 -92
- package/stylelint.config.cjs +7 -7
- package/tsconfig.json +50 -50
- package/utils/upload/AwsS3.ts +68 -0
- package/utils/upload/fileHandlers.ts +27 -0
- package/utils/upload/index.ts +2 -0
- package/vite/index.d.ts +1 -0
- package/vite/index.mjs +27 -0
- package/vue/components/echarts/index.ts +1 -0
- package/vue/components/echarts/src/ECharts.vue +48 -0
- package/vue/components/index.ts +1 -0
- package/vue/components/infinite-query/index.ts +1 -1
- package/vue/components/infinite-query/src/InfiniteQuery.vue +199 -205
- package/vue/components/infinite-query/src/useCreateTrigger.ts +39 -39
- package/vue/components/test/KitTest.vue +9 -0
- package/vue/components/test/testStore.ts +11 -0
- package/admin/hooks/index.ts +0 -5
- package/admin/hooks/usePageTab.ts +0 -35
- package/kitDependencies.ts +0 -43
|
@@ -1,30 +1,46 @@
|
|
|
1
1
|
import { useInfiniteQuery, useQuery } from '@tanstack/vue-query';
|
|
2
|
-
import {
|
|
2
|
+
import { getNextPageParam, keepPreviousData } from '../../../../request/queryClient';
|
|
3
|
+
import { type ShcemeConfig, useFilterParams } from './useFilterParams';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
|
-
|
|
6
|
+
* 函数用于创建一个带有过滤参数的分页查询。
|
|
7
|
+
*
|
|
8
|
+
* @param apiFn - API函数
|
|
9
|
+
* @param params - 过滤参数的配置
|
|
10
|
+
* @returns 返回一个元组,包含查询对象和过滤参数
|
|
6
11
|
*/
|
|
7
|
-
export function useFilterPaginationQuery<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
export function useFilterPaginationQuery<
|
|
13
|
+
Api extends Api.Request,
|
|
14
|
+
P extends Api.GetParam<Api>,
|
|
15
|
+
>(apiFn: Api, params: ShcemeConfig<P>) {
|
|
16
|
+
const filterParams = useFilterParams<Api.GetParam<Api>>(params);
|
|
11
17
|
const filterQuery = useQuery({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
queryKey: [apiFn.id, 'pagination', filterParams.$params],
|
|
19
|
+
queryFn: () => apiFn(filterParams.$params) as Promise<Api.GetData<Api>>,
|
|
20
|
+
placeholderData: keepPreviousData,
|
|
15
21
|
});
|
|
16
22
|
|
|
17
23
|
return [filterQuery, filterParams] as const;
|
|
18
24
|
}
|
|
19
25
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
/**
|
|
27
|
+
* 函数用于创建一个带有过滤参数的无限滚动查询。
|
|
28
|
+
*
|
|
29
|
+
* @param apiFn - API函数
|
|
30
|
+
* @param params - 过滤参数的配置
|
|
31
|
+
* @returns 返回一个数组,包含查询对象和过滤参数
|
|
32
|
+
*/
|
|
33
|
+
export function useFilterInfiniteQuery<
|
|
34
|
+
Api extends Api.Request,
|
|
35
|
+
P extends Api.GetParam<Api>,
|
|
36
|
+
>(apiFn: Api, params: ShcemeConfig<P>) {
|
|
37
|
+
const filterParams = useFilterParams<Api.GetParam<Api>>(params);
|
|
24
38
|
const filterQuery = useInfiniteQuery({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
39
|
+
queryKey: [apiFn.id, 'infinite', filterParams.$params],
|
|
40
|
+
queryFn: ctx => (apiFn({ ...filterParams.$params, ...ctx.pageParam }) as Promise<Api.GetData<Api>>),
|
|
41
|
+
initialPageParam: { page: 1, page_size: 10 },
|
|
42
|
+
placeholderData: keepPreviousData,
|
|
43
|
+
getNextPageParam,
|
|
28
44
|
});
|
|
29
45
|
|
|
30
46
|
return [filterQuery, filterParams] as const;
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useVModel } from '@vueuse/core';
|
|
3
|
+
import CKEditor from '@ckeditor/ckeditor5-vue';
|
|
4
|
+
import { ClassicEditor } from '@ckeditor/ckeditor5-editor-classic';
|
|
5
|
+
import { Alignment } from '@ckeditor/ckeditor5-alignment';
|
|
6
|
+
import { Autoformat } from '@ckeditor/ckeditor5-autoformat';
|
|
7
|
+
import { Bold, Code, Italic, Strikethrough, Subscript, Superscript, Underline } from '@ckeditor/ckeditor5-basic-styles';
|
|
8
|
+
import { BlockQuote } from '@ckeditor/ckeditor5-block-quote';
|
|
9
|
+
import { CodeBlock } from '@ckeditor/ckeditor5-code-block';
|
|
10
|
+
import { Essentials } from '@ckeditor/ckeditor5-essentials';
|
|
11
|
+
import { Font } from '@ckeditor/ckeditor5-font';
|
|
12
|
+
import { Heading } from '@ckeditor/ckeditor5-heading';
|
|
13
|
+
import { Highlight } from '@ckeditor/ckeditor5-highlight';
|
|
14
|
+
import { HorizontalLine } from '@ckeditor/ckeditor5-horizontal-line';
|
|
15
|
+
import { GeneralHtmlSupport } from '@ckeditor/ckeditor5-html-support';
|
|
16
|
+
import { HtmlEmbed } from '@ckeditor/ckeditor5-html-embed';
|
|
17
|
+
import { AutoImage, Image, ImageCaption, ImageInsert, ImageResize, ImageStyle, ImageToolbar, ImageUpload, PictureEditing } from '@ckeditor/ckeditor5-image';
|
|
18
|
+
import { Indent, IndentBlock } from '@ckeditor/ckeditor5-indent';
|
|
19
|
+
import { AutoLink, Link, LinkImage } from '@ckeditor/ckeditor5-link';
|
|
20
|
+
import { List, ListProperties, TodoList } from '@ckeditor/ckeditor5-list'; import { MediaEmbed } from '@ckeditor/ckeditor5-media-embed';
|
|
21
|
+
import { Paragraph } from '@ckeditor/ckeditor5-paragraph';
|
|
22
|
+
import { RemoveFormat } from '@ckeditor/ckeditor5-remove-format';
|
|
23
|
+
import { Table, TableCaption, TableCellProperties, TableColumnResize, TableProperties, TableToolbar } from '@ckeditor/ckeditor5-table';
|
|
24
|
+
import { TextTransformation } from '@ckeditor/ckeditor5-typing';
|
|
25
|
+
import { WordCount } from '@ckeditor/ckeditor5-word-count';
|
|
26
|
+
import { SourceEditing } from '@ckeditor/ckeditor5-source-editing';
|
|
27
|
+
import { ShowBlocks } from '@ckeditor/ckeditor5-show-blocks';
|
|
28
|
+
import type { CKEditorConfig, PluginConstructor } from './type';
|
|
29
|
+
|
|
30
|
+
import '@ckeditor/ckeditor5-build-classic/build/translations/zh-cn';
|
|
31
|
+
import '@ckeditor/ckeditor5-html-embed/build/translations/zh-cn';
|
|
32
|
+
|
|
33
|
+
const editorConfig: CKEditorConfig = {
|
|
34
|
+
plugins: [
|
|
35
|
+
Alignment,
|
|
36
|
+
Autoformat,
|
|
37
|
+
AutoImage,
|
|
38
|
+
AutoLink,
|
|
39
|
+
BlockQuote,
|
|
40
|
+
Bold,
|
|
41
|
+
Code,
|
|
42
|
+
CodeBlock,
|
|
43
|
+
Essentials,
|
|
44
|
+
Font,
|
|
45
|
+
GeneralHtmlSupport,
|
|
46
|
+
HtmlEmbed,
|
|
47
|
+
Heading,
|
|
48
|
+
Highlight,
|
|
49
|
+
HorizontalLine,
|
|
50
|
+
Image,
|
|
51
|
+
ImageCaption,
|
|
52
|
+
ImageInsert,
|
|
53
|
+
ImageResize,
|
|
54
|
+
ImageStyle,
|
|
55
|
+
ImageToolbar,
|
|
56
|
+
ImageUpload,
|
|
57
|
+
Indent,
|
|
58
|
+
IndentBlock,
|
|
59
|
+
Italic,
|
|
60
|
+
Link,
|
|
61
|
+
LinkImage,
|
|
62
|
+
List,
|
|
63
|
+
ListProperties,
|
|
64
|
+
TodoList,
|
|
65
|
+
MediaEmbed,
|
|
66
|
+
Paragraph,
|
|
67
|
+
PictureEditing,
|
|
68
|
+
RemoveFormat,
|
|
69
|
+
Strikethrough,
|
|
70
|
+
Subscript,
|
|
71
|
+
Superscript,
|
|
72
|
+
Table,
|
|
73
|
+
TableCaption,
|
|
74
|
+
TableCellProperties,
|
|
75
|
+
TableColumnResize,
|
|
76
|
+
TableProperties,
|
|
77
|
+
TableToolbar,
|
|
78
|
+
TextTransformation,
|
|
79
|
+
Underline,
|
|
80
|
+
WordCount,
|
|
81
|
+
SourceEditing,
|
|
82
|
+
ShowBlocks,
|
|
83
|
+
],
|
|
84
|
+
toolbar: {
|
|
85
|
+
items: [
|
|
86
|
+
'undo',
|
|
87
|
+
'redo',
|
|
88
|
+
'|',
|
|
89
|
+
'showBlocks',
|
|
90
|
+
'selectAll',
|
|
91
|
+
'|',
|
|
92
|
+
'heading',
|
|
93
|
+
'|',
|
|
94
|
+
'fontSize',
|
|
95
|
+
'fontFamily',
|
|
96
|
+
'fontColor',
|
|
97
|
+
'fontBackgroundColor',
|
|
98
|
+
'|',
|
|
99
|
+
'bold',
|
|
100
|
+
'italic',
|
|
101
|
+
'underline',
|
|
102
|
+
{
|
|
103
|
+
label: 'Formatting',
|
|
104
|
+
icon: 'text',
|
|
105
|
+
items: ['strikethrough', 'subscript', 'superscript', 'code', 'horizontalLine', '|', 'removeFormat'],
|
|
106
|
+
},
|
|
107
|
+
'|',
|
|
108
|
+
'link',
|
|
109
|
+
'insertImage',
|
|
110
|
+
'insertTable',
|
|
111
|
+
{
|
|
112
|
+
label: 'Insert',
|
|
113
|
+
icon: 'plus',
|
|
114
|
+
items: ['highlight', 'blockQuote', 'mediaEmbed', 'codeBlock', 'htmlEmbed'],
|
|
115
|
+
},
|
|
116
|
+
'|',
|
|
117
|
+
'alignment',
|
|
118
|
+
'|',
|
|
119
|
+
'bulletedList',
|
|
120
|
+
'numberedList',
|
|
121
|
+
'todoList',
|
|
122
|
+
'outdent',
|
|
123
|
+
'indent',
|
|
124
|
+
'|',
|
|
125
|
+
'sourceEditing',
|
|
126
|
+
],
|
|
127
|
+
shouldNotGroupWhenFull: true,
|
|
128
|
+
},
|
|
129
|
+
htmlSupport: {
|
|
130
|
+
allow: [
|
|
131
|
+
{
|
|
132
|
+
name: /^.*$/,
|
|
133
|
+
styles: true,
|
|
134
|
+
attributes: true,
|
|
135
|
+
classes: true,
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
fontSize: {
|
|
140
|
+
options: [10, 12, 14, 'default', 18, 20, 22],
|
|
141
|
+
supportAllValues: true,
|
|
142
|
+
},
|
|
143
|
+
image: {
|
|
144
|
+
styles: [
|
|
145
|
+
'alignCenter',
|
|
146
|
+
'alignLeft',
|
|
147
|
+
'alignRight',
|
|
148
|
+
] as any,
|
|
149
|
+
resizeOptions: [
|
|
150
|
+
{ name: 'resizeImage:original', label: 'Original', value: null },
|
|
151
|
+
{ name: 'resizeImage:25', label: '25%', value: '25' },
|
|
152
|
+
{ name: 'resizeImage:50', label: '50%', value: '50' },
|
|
153
|
+
{ name: 'resizeImage:75', label: '75%', value: '75' },
|
|
154
|
+
],
|
|
155
|
+
toolbar: [
|
|
156
|
+
'imageTextAlternative',
|
|
157
|
+
'toggleImageCaption',
|
|
158
|
+
'|',
|
|
159
|
+
'imageStyle:inline',
|
|
160
|
+
'imageStyle:wrapText',
|
|
161
|
+
'imageStyle:breakText',
|
|
162
|
+
'imageStyle:side',
|
|
163
|
+
'|',
|
|
164
|
+
'resizeImage',
|
|
165
|
+
],
|
|
166
|
+
resizeUnit: 'px',
|
|
167
|
+
},
|
|
168
|
+
list: {
|
|
169
|
+
properties: {
|
|
170
|
+
styles: true,
|
|
171
|
+
startIndex: true,
|
|
172
|
+
reversed: true,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
link: {
|
|
176
|
+
addTargetToExternalLinks: true,
|
|
177
|
+
defaultProtocol: 'https://',
|
|
178
|
+
decorators: {
|
|
179
|
+
toggleDownloadable: {
|
|
180
|
+
mode: 'manual',
|
|
181
|
+
label: 'Downloadable',
|
|
182
|
+
attributes: {
|
|
183
|
+
download: 'file',
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
table: {
|
|
189
|
+
contentToolbar: [
|
|
190
|
+
'tableColumn',
|
|
191
|
+
'tableRow',
|
|
192
|
+
'mergeTableCells',
|
|
193
|
+
'tableProperties',
|
|
194
|
+
'tableCellProperties',
|
|
195
|
+
'toggleTableCaption',
|
|
196
|
+
],
|
|
197
|
+
},
|
|
198
|
+
htmlEmbed: {
|
|
199
|
+
showPreviews: true,
|
|
200
|
+
},
|
|
201
|
+
wordCount: {
|
|
202
|
+
displayWords: true,
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
</script>
|
|
206
|
+
|
|
207
|
+
<script setup lang="ts">
|
|
208
|
+
const props = withDefaults(defineProps<{
|
|
209
|
+
modelValue?: string
|
|
210
|
+
plugins?: PluginConstructor[]
|
|
211
|
+
}>(), {
|
|
212
|
+
modelValue: '',
|
|
213
|
+
plugins: () => [],
|
|
214
|
+
});
|
|
215
|
+
const emits = defineEmits<{
|
|
216
|
+
(e: 'update:modelValue', value: string): void
|
|
217
|
+
}>();
|
|
218
|
+
|
|
219
|
+
const editorData = useVModel(props, 'modelValue', emits);
|
|
220
|
+
const localeEditorConfig = { ...editorConfig };
|
|
221
|
+
localeEditorConfig.extraPlugins = [...props.plugins];
|
|
222
|
+
</script>
|
|
223
|
+
|
|
224
|
+
<template>
|
|
225
|
+
<div class="editor-wrapper">
|
|
226
|
+
<CKEditor.component v-model="editorData" :editor="ClassicEditor" :config="localeEditorConfig" />
|
|
227
|
+
</div>
|
|
228
|
+
</template>
|
|
229
|
+
|
|
230
|
+
<style scoped lang="scss">
|
|
231
|
+
.editor-wrapper {
|
|
232
|
+
:deep(.ck-editor__main > .ck-content) {
|
|
233
|
+
height: 500px;
|
|
234
|
+
overflow: auto;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
:root.dark .editor-wrapper {
|
|
239
|
+
/* Overrides the border radius setting in the theme. */
|
|
240
|
+
// --ck-border-radius: 4px;
|
|
241
|
+
|
|
242
|
+
/* Overrides the default font size in the theme. */
|
|
243
|
+
// --ck-font-size-base: 14px;
|
|
244
|
+
|
|
245
|
+
/* Helper variables to avoid duplication in the colors. */
|
|
246
|
+
--ck-custom-background: hsl(270deg 1% 29%);
|
|
247
|
+
--ck-custom-foreground: hsl(255deg 3% 18%);
|
|
248
|
+
--ck-custom-border: hsl(300deg 1% 22%);
|
|
249
|
+
--ck-custom-white: hsl(0deg 0% 100%);
|
|
250
|
+
|
|
251
|
+
/* -- Overrides generic colors. ------------------------------------------------------------- */
|
|
252
|
+
|
|
253
|
+
--ck-color-base-foreground: var(--ck-custom-background);
|
|
254
|
+
--ck-color-focus-border: hsl(208deg 90% 62%);
|
|
255
|
+
--ck-color-text: hsl(0deg 0% 98%);
|
|
256
|
+
--ck-color-shadow-drop: hsl(0deg 0% 0% / 20%);
|
|
257
|
+
--ck-color-shadow-inner: hsl(0deg 0% 0% / 10%);
|
|
258
|
+
|
|
259
|
+
/* -- Overrides the default .ck-button class colors. ---------------------------------------- */
|
|
260
|
+
|
|
261
|
+
--ck-color-button-default-background: var(--ck-custom-background);
|
|
262
|
+
--ck-color-button-default-hover-background: hsl(270deg 1% 22%);
|
|
263
|
+
--ck-color-button-default-active-background: hsl(270deg 2% 20%);
|
|
264
|
+
--ck-color-button-default-active-shadow: hsl(270deg 2% 23%);
|
|
265
|
+
--ck-color-button-default-disabled-background: var(--ck-custom-background);
|
|
266
|
+
--ck-color-button-on-background: var(--ck-custom-foreground);
|
|
267
|
+
--ck-color-button-on-hover-background: hsl(255deg 4% 16%);
|
|
268
|
+
--ck-color-button-on-active-background: hsl(255deg 4% 14%);
|
|
269
|
+
--ck-color-button-on-active-shadow: hsl(240deg 3% 19%);
|
|
270
|
+
--ck-color-button-on-disabled-background: var(--ck-custom-foreground);
|
|
271
|
+
--ck-color-button-action-background: hsl(168deg 76% 42%);
|
|
272
|
+
--ck-color-button-action-hover-background: hsl(168deg 76% 38%);
|
|
273
|
+
--ck-color-button-action-active-background: hsl(168deg 76% 36%);
|
|
274
|
+
--ck-color-button-action-active-shadow: hsl(168deg 75% 34%);
|
|
275
|
+
--ck-color-button-action-disabled-background: hsl(168deg 76% 42%);
|
|
276
|
+
--ck-color-button-action-text: var(--ck-custom-white);
|
|
277
|
+
--ck-color-button-save: hsl(120deg 100% 46%);
|
|
278
|
+
--ck-color-button-cancel: hsl(15deg 100% 56%);
|
|
279
|
+
|
|
280
|
+
/* -- Overrides the default .ck-dropdown class colors. -------------------------------------- */
|
|
281
|
+
|
|
282
|
+
--ck-color-dropdown-panel-background: var(--ck-custom-background);
|
|
283
|
+
--ck-color-dropdown-panel-border: var(--ck-custom-foreground);
|
|
284
|
+
|
|
285
|
+
/* -- Overrides the default .ck-splitbutton class colors. ----------------------------------- */
|
|
286
|
+
|
|
287
|
+
--ck-color-split-button-hover-background: var(--ck-color-button-default-hover-background);
|
|
288
|
+
--ck-color-split-button-hover-border: var(--ck-custom-foreground);
|
|
289
|
+
|
|
290
|
+
/* -- Overrides the default .ck-input class colors. ----------------------------------------- */
|
|
291
|
+
|
|
292
|
+
--ck-color-input-background: var(--ck-custom-background);
|
|
293
|
+
--ck-color-input-border: hsl(257deg 3% 43%);
|
|
294
|
+
--ck-color-input-text: hsl(0deg 0% 98%);
|
|
295
|
+
--ck-color-input-disabled-background: hsl(255deg 4% 21%);
|
|
296
|
+
--ck-color-input-disabled-border: hsl(250deg 3% 38%);
|
|
297
|
+
--ck-color-input-disabled-text: hsl(0deg 0% 78%);
|
|
298
|
+
|
|
299
|
+
/* -- Overrides the default .ck-labeled-field-view class colors. ---------------------------- */
|
|
300
|
+
|
|
301
|
+
--ck-color-labeled-field-label-background: var(--ck-custom-background);
|
|
302
|
+
|
|
303
|
+
/* -- Overrides the default .ck-list class colors. ------------------------------------------ */
|
|
304
|
+
|
|
305
|
+
--ck-color-list-background: var(--ck-custom-background);
|
|
306
|
+
--ck-color-list-button-hover-background: var(--ck-custom-foreground);
|
|
307
|
+
--ck-color-list-button-on-background: hsl(208deg 88% 52%);
|
|
308
|
+
--ck-color-list-button-on-text: var(--ck-custom-white);
|
|
309
|
+
|
|
310
|
+
/* -- Overrides the default .ck-balloon-panel class colors. --------------------------------- */
|
|
311
|
+
|
|
312
|
+
--ck-color-panel-background: var(--ck-custom-background);
|
|
313
|
+
--ck-color-panel-border: var(--ck-custom-border);
|
|
314
|
+
|
|
315
|
+
/* -- Overrides the default .ck-toolbar class colors. --------------------------------------- */
|
|
316
|
+
|
|
317
|
+
--ck-color-toolbar-background: var(--ck-custom-background);
|
|
318
|
+
--ck-color-toolbar-border: var(--ck-custom-border);
|
|
319
|
+
|
|
320
|
+
/* -- Overrides the default .ck-tooltip class colors. --------------------------------------- */
|
|
321
|
+
|
|
322
|
+
--ck-color-tooltip-background: hsl(252deg 7% 14%);
|
|
323
|
+
--ck-color-tooltip-text: hsl(0deg 0% 93%);
|
|
324
|
+
|
|
325
|
+
/* -- Overrides the default colors used by the ckeditor5-image package. --------------------- */
|
|
326
|
+
|
|
327
|
+
--ck-color-image-caption-background: hsl(0deg 0% 97%);
|
|
328
|
+
--ck-color-image-caption-text: hsl(0deg 0% 20%);
|
|
329
|
+
|
|
330
|
+
/* -- Overrides the default colors used by the ckeditor5-widget package. -------------------- */
|
|
331
|
+
|
|
332
|
+
--ck-color-widget-blurred-border: hsl(0deg 0% 87%);
|
|
333
|
+
--ck-color-widget-hover-border: hsl(43deg 100% 68%);
|
|
334
|
+
--ck-color-widget-editable-focus-background: var(--ck-custom-white);
|
|
335
|
+
|
|
336
|
+
/* -- Overrides the default colors used by the ckeditor5-link package. ---------------------- */
|
|
337
|
+
|
|
338
|
+
--ck-color-link-default: hsl(190deg 100% 75%);
|
|
339
|
+
--ck-color-base-background: #141414;
|
|
340
|
+
--ck-color-base-border: #424242;
|
|
341
|
+
}
|
|
342
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AwsS3 } from '../../../../utils/upload';
|
|
2
|
+
import type { PluginConstructor } from './type';
|
|
3
|
+
|
|
4
|
+
export { createImageUploaderForAws3 };
|
|
5
|
+
|
|
6
|
+
function createImageUploaderForAws3(awsS3: AwsS3, rootDir?: string): PluginConstructor {
|
|
7
|
+
return function (editor) {
|
|
8
|
+
editor.plugins.get('FileRepository').createUploadAdapter = (loader) => {
|
|
9
|
+
return {
|
|
10
|
+
async upload() {
|
|
11
|
+
const file = await loader.file;
|
|
12
|
+
|
|
13
|
+
if (file) {
|
|
14
|
+
const { uploader, fileURL } = await awsS3.upload(file, rootDir);
|
|
15
|
+
|
|
16
|
+
uploader.on('httpUploadProgress', (progress) => {
|
|
17
|
+
loader.uploadTotal = progress.total ?? null;
|
|
18
|
+
loader.uploaded = progress.loaded ?? 0;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
await uploader.done();
|
|
22
|
+
|
|
23
|
+
return { default: fileURL };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {};
|
|
27
|
+
},
|
|
28
|
+
abort() {
|
|
29
|
+
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type CKEditor from '@ckeditor/ckeditor5-vue';
|
|
2
|
+
import type { RequiredDeep } from 'type-fest';
|
|
3
|
+
import type { ComponentProps } from 'vue-component-type-helpers';
|
|
4
|
+
|
|
5
|
+
export type CKEditorProps = NonNullable<ComponentProps<typeof CKEditor['component']>>;
|
|
6
|
+
export type CKEditorConfig = NonNullable<CKEditorProps['config']>;
|
|
7
|
+
export type PluginConstructor = NonNullable<CKEditorConfig['extraPlugins']>[number];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as ScrollNav } from './src/ScrollNav.vue';
|
|
1
|
+
export { default as ScrollNav } from './src/ScrollNav.vue';
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue';
|
|
3
|
-
import { useElementSize } from '@vueuse/core';
|
|
4
|
-
|
|
5
|
-
const props = defineProps<{
|
|
6
|
-
selector: string
|
|
7
|
-
}>();
|
|
8
|
-
|
|
9
|
-
const $content = document.querySelector(props.selector) as HTMLElement;
|
|
10
|
-
const $contentParent = $content.parentElement;
|
|
11
|
-
const { height: contentParentH } = useElementSize($contentParent);
|
|
12
|
-
const { height: contentH } = useElementSize($content);
|
|
13
|
-
const visible = computed(() => contentParentH.value * 2 < contentH.value);
|
|
14
|
-
|
|
15
|
-
function scrollTo(top: number) {
|
|
16
|
-
$contentParent?.scrollTo({ top });
|
|
17
|
-
}
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<template>
|
|
21
|
-
<div v-if="visible" class="wrapper">
|
|
22
|
-
<div class="btn" @click="scrollTo(0)">
|
|
23
|
-
<i class="i-fluent:arrow-previous-24-filled rotate-90" />
|
|
24
|
-
</div>
|
|
25
|
-
<div class="btn" @click="scrollTo($contentParent?.scrollHeight ?? Infinity)">
|
|
26
|
-
<i class="i-fluent:arrow-previous-24-filled rotate-270" />
|
|
27
|
-
</div>
|
|
28
|
-
<!-- <div v-if="showReturn" class="btn" @click="toLastY()">
|
|
29
|
-
<i class="i-fluent:arrow-hook-down-left-24-filled rotate-270" />
|
|
30
|
-
</div> -->
|
|
31
|
-
</div>
|
|
32
|
-
</template>
|
|
33
|
-
|
|
34
|
-
<style lang="scss" scoped>
|
|
35
|
-
.wrapper {
|
|
36
|
-
font-size: 18px;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.btn {
|
|
40
|
-
display: flex;
|
|
41
|
-
width: 2em;
|
|
42
|
-
height: 2em;
|
|
43
|
-
align-items: center;
|
|
44
|
-
justify-content: center;
|
|
45
|
-
border-radius: 2px;
|
|
46
|
-
background: #bcbcbc;
|
|
47
|
-
color: #000;
|
|
48
|
-
cursor: pointer;
|
|
49
|
-
opacity: 0.5;
|
|
50
|
-
|
|
51
|
-
&:active {
|
|
52
|
-
transform: scale(0.9);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
& + & {
|
|
56
|
-
margin-top: 1px;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import { useElementSize } from '@vueuse/core';
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
selector: string
|
|
7
|
+
}>();
|
|
8
|
+
|
|
9
|
+
const $content = document.querySelector(props.selector) as HTMLElement;
|
|
10
|
+
const $contentParent = $content.parentElement;
|
|
11
|
+
const { height: contentParentH } = useElementSize($contentParent);
|
|
12
|
+
const { height: contentH } = useElementSize($content);
|
|
13
|
+
const visible = computed(() => contentParentH.value * 2 < contentH.value);
|
|
14
|
+
|
|
15
|
+
function scrollTo(top: number) {
|
|
16
|
+
$contentParent?.scrollTo({ top });
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<div v-if="visible" class="wrapper">
|
|
22
|
+
<div class="btn" @click="scrollTo(0)">
|
|
23
|
+
<i class="i-fluent:arrow-previous-24-filled rotate-90" />
|
|
24
|
+
</div>
|
|
25
|
+
<div class="btn" @click="scrollTo($contentParent?.scrollHeight ?? Infinity)">
|
|
26
|
+
<i class="i-fluent:arrow-previous-24-filled rotate-270" />
|
|
27
|
+
</div>
|
|
28
|
+
<!-- <div v-if="showReturn" class="btn" @click="toLastY()">
|
|
29
|
+
<i class="i-fluent:arrow-hook-down-left-24-filled rotate-270" />
|
|
30
|
+
</div> -->
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<style lang="scss" scoped>
|
|
35
|
+
.wrapper {
|
|
36
|
+
font-size: 18px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.btn {
|
|
40
|
+
display: flex;
|
|
41
|
+
width: 2em;
|
|
42
|
+
height: 2em;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
border-radius: 2px;
|
|
46
|
+
background: #bcbcbc;
|
|
47
|
+
color: #000;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
opacity: 0.5;
|
|
50
|
+
|
|
51
|
+
&:active {
|
|
52
|
+
transform: scale(0.9);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
& + & {
|
|
56
|
+
margin-top: 1px;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import Hash from './src/Hash.vue';
|
|
2
|
-
import Amount from './src/Amount.vue';
|
|
3
|
-
import Datetime from './src/Datetime.vue';
|
|
4
|
-
import Duration from './src/Duration.vue';
|
|
5
|
-
|
|
6
|
-
export { createTagGetter } from './src/createTagGetter';
|
|
7
|
-
|
|
8
|
-
export const Text = {
|
|
9
|
-
Hash,
|
|
10
|
-
Amount,
|
|
11
|
-
Datetime,
|
|
12
|
-
Duration,
|
|
13
|
-
};
|
|
1
|
+
import Hash from './src/Hash.vue';
|
|
2
|
+
import Amount from './src/Amount.vue';
|
|
3
|
+
import Datetime from './src/Datetime.vue';
|
|
4
|
+
import Duration from './src/Duration.vue';
|
|
5
|
+
|
|
6
|
+
export { createTagGetter } from './src/createTagGetter';
|
|
7
|
+
|
|
8
|
+
export const Text = {
|
|
9
|
+
Hash,
|
|
10
|
+
Amount,
|
|
11
|
+
Datetime,
|
|
12
|
+
Duration,
|
|
13
|
+
};
|