@srcker/editor-vue-next 1.0.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.
Files changed (95) hide show
  1. package/.vscode/extensions.json +3 -0
  2. package/README.md +50 -0
  3. package/index.html +13 -0
  4. package/index.ts +11 -0
  5. package/jsconfig.json +8 -0
  6. package/package.json +69 -0
  7. package/public/favicon.ico +0 -0
  8. package/src/App.vue +9 -0
  9. package/src/App.vue.js +17 -0
  10. package/src/Button/BackgroundButton.vue +331 -0
  11. package/src/Button/BackgroundButton.vue.js +243 -0
  12. package/src/Button/BlockQuoteButton.vue +26 -0
  13. package/src/Button/BlockQuoteButton.vue.js +56 -0
  14. package/src/Button/BoldButton.vue +29 -0
  15. package/src/Button/BoldButton.vue.js +56 -0
  16. package/src/Button/BulletListButton.vue +114 -0
  17. package/src/Button/BulletListButton.vue.js +147 -0
  18. package/src/Button/CodeBlockButton.vue +28 -0
  19. package/src/Button/CodeBlockButton.vue.js +56 -0
  20. package/src/Button/CodeButton.vue +30 -0
  21. package/src/Button/CodeButton.vue.js +56 -0
  22. package/src/Button/FontSizeButton.vue +85 -0
  23. package/src/Button/FontSizeButton.vue.js +131 -0
  24. package/src/Button/FormatButton.vue +25 -0
  25. package/src/Button/FormatButton.vue.js +54 -0
  26. package/src/Button/HeadingButton.vue +103 -0
  27. package/src/Button/HeadingButton.vue.js +164 -0
  28. package/src/Button/ImageUploadButton.vue +93 -0
  29. package/src/Button/ImageUploadButton.vue.js +123 -0
  30. package/src/Button/IndentLeftButton.vue +25 -0
  31. package/src/Button/IndentLeftButton.vue.js +54 -0
  32. package/src/Button/IndentRightButton.vue +29 -0
  33. package/src/Button/IndentRightButton.vue.js +54 -0
  34. package/src/Button/ItalicButton.vue +29 -0
  35. package/src/Button/ItalicButton.vue.js +56 -0
  36. package/src/Button/LineHeightButton.vue +88 -0
  37. package/src/Button/LineHeightButton.vue.js +131 -0
  38. package/src/Button/LinkButton.vue +44 -0
  39. package/src/Button/LinkButton.vue.js +69 -0
  40. package/src/Button/OrderedListButton.vue +121 -0
  41. package/src/Button/OrderedListButton.vue.js +146 -0
  42. package/src/Button/RedoButton.vue +29 -0
  43. package/src/Button/RedoButton.vue.js +55 -0
  44. package/src/Button/StrikeButton.vue +30 -0
  45. package/src/Button/StrikeButton.vue.js +56 -0
  46. package/src/Button/SubscriptButton.vue +29 -0
  47. package/src/Button/SubscriptButton.vue.js +56 -0
  48. package/src/Button/SuperscriptButton.vue +29 -0
  49. package/src/Button/SuperscriptButton.vue.js +56 -0
  50. package/src/Button/TextAlignCenterButton.vue +26 -0
  51. package/src/Button/TextAlignCenterButton.vue.js +56 -0
  52. package/src/Button/TextAlignLeftButton.vue +26 -0
  53. package/src/Button/TextAlignLeftButton.vue.js +56 -0
  54. package/src/Button/TextAlignRightButton.vue +26 -0
  55. package/src/Button/TextAlignRightButton.vue.js +56 -0
  56. package/src/Button/TextColorButton.vue +329 -0
  57. package/src/Button/TextColorButton.vue.js +243 -0
  58. package/src/Button/ThemeButton.vue +34 -0
  59. package/src/Button/ThemeButton.vue.js +63 -0
  60. package/src/Button/UnderLineButton.vue +29 -0
  61. package/src/Button/UnderLineButton.vue.js +56 -0
  62. package/src/Button/UndoButton.vue +29 -0
  63. package/src/Button/UndoButton.vue.js +55 -0
  64. package/src/Components/IconArrow.vue +16 -0
  65. package/src/Components/IconArrow.vue.js +30 -0
  66. package/src/Components/IconCheck.vue +40 -0
  67. package/src/Components/IconCheck.vue.js +59 -0
  68. package/src/EditorToolbar.vue +150 -0
  69. package/src/EditorToolbar.vue.js +306 -0
  70. package/src/Extensions/BulletListStyle.js +19 -0
  71. package/src/Extensions/BulletListStyle.ts +24 -0
  72. package/src/Extensions/FontSize.js +27 -0
  73. package/src/Extensions/FontSize.ts +37 -0
  74. package/src/Extensions/Indent.js +58 -0
  75. package/src/Extensions/Indent.ts +73 -0
  76. package/src/Extensions/OrderedListStyle.js +19 -0
  77. package/src/Extensions/OrderedListStyle.ts +24 -0
  78. package/src/Extensions/UploadImage.js +18 -0
  79. package/src/Extensions/UploadImage.ts +22 -0
  80. package/src/Extensions/shims.d.ts +26 -0
  81. package/src/RichEditor.vue +191 -0
  82. package/src/RichEditor.vue.js +199 -0
  83. package/src/env.d.ts +7 -0
  84. package/src/index.js +6 -0
  85. package/src/index.ts +11 -0
  86. package/src/main.js +4 -0
  87. package/src/main.ts +7 -0
  88. package/src/styles/style.scss +196 -0
  89. package/src/styles/theme.css +28 -0
  90. package/src/styles/variables.css +158 -0
  91. package/src/styles/variables.scss +175 -0
  92. package/src/types.js +1 -0
  93. package/src/types.ts +7 -0
  94. package/tsconfig.json +17 -0
  95. package/vite.config.ts +29 -0
@@ -0,0 +1,158 @@
1
+ .srcker-html-content {
2
+ outline: none;
3
+ min-height: 100%;
4
+ font-size: 16px;
5
+ line-height: 1.6;
6
+ outline: none;
7
+ color: var(--color);
8
+ background: var(--background);
9
+ }
10
+
11
+ /* ===== focus ===== */
12
+ .srcker-html-content .is-focused {
13
+ background: var(--hover-background);
14
+ }
15
+
16
+ /* ===== placeholder ===== */
17
+ .srcker-html-content p.is-editor-empty:first-child::before {
18
+ color: #888;
19
+ content: attr(data-placeholder);
20
+ float: left;
21
+ height: 0;
22
+ pointer-events: none;
23
+ }
24
+
25
+ /* ===== list ===== */
26
+ .srcker-html-content ul,
27
+ .srcker-html-content ol {
28
+ padding-left: 1.5rem;
29
+ margin: 0.5rem 0;
30
+ }
31
+
32
+ .srcker-html-content ul[style*="list-style-type"],
33
+ .srcker-html-content ol[style*="list-style-type"] {
34
+ padding-left: 40px !important;
35
+ }
36
+
37
+ .srcker-html-content ul li,
38
+ .srcker-html-content ol li {
39
+ padding: 0;
40
+ margin: 0;
41
+ }
42
+
43
+ /* ===== blockquote ===== */
44
+ .srcker-html-content blockquote {
45
+ border-left: 3px solid var(--border-color);
46
+ margin: 1rem 0;
47
+ padding-left: 1rem;
48
+ font-style: italic;
49
+ color: #555;
50
+ background: rgba(0, 0, 0, 0.02);
51
+ }
52
+
53
+ /* ===== inline code ===== */
54
+ .srcker-html-content code {
55
+ background: #f0f0f0;
56
+ color: #c7254e;
57
+ border-radius: 4px;
58
+ font-size: 12px;
59
+ padding: 0.25em 0.3em;
60
+ font-family: 'JetBrainsMono', monospace;
61
+ }
62
+
63
+ /* ===== code block ===== */
64
+ .srcker-html-content pre {
65
+ background: #000;
66
+ border-radius: 5px;
67
+ color: #fff;
68
+ font-family: 'JetBrainsMono', monospace;
69
+ margin: 15px 0;
70
+ padding: 5px 10px;
71
+ }
72
+
73
+ .srcker-html-content pre code {
74
+ background: none;
75
+ color: inherit;
76
+ font-size: 12px;
77
+ padding: 0;
78
+ }
79
+
80
+ /* ===== hr ===== */
81
+ .srcker-html-content hr {
82
+ border: none;
83
+ border-top: 1px solid #ccc;
84
+ margin: 20px 0;
85
+ }
86
+
87
+ /* ===== link ===== */
88
+ .srcker-html-content a {
89
+ color: #1890ff;
90
+ text-decoration: underline;
91
+ cursor: pointer;
92
+ }
93
+
94
+ /* ===== heading ===== */
95
+ .srcker-html-content h1,
96
+ .srcker-html-content h2,
97
+ .srcker-html-content h3,
98
+ .srcker-html-content h4,
99
+ .srcker-html-content h5,
100
+ .srcker-html-content h6 {
101
+ margin-top: 1em;
102
+ margin-bottom: 0.5em;
103
+ line-height: 1.3;
104
+ padding-left: 0 !important;
105
+ }
106
+
107
+ /* ===== image ===== */
108
+ .srcker-html-content img.resizable-image {
109
+ cursor: pointer;
110
+ transition: opacity 0.2s;
111
+ }
112
+
113
+ .srcker-html-content img.resizable-image:hover {
114
+ opacity: 0.8;
115
+ }
116
+
117
+ .srcker-html-content img {
118
+ max-width: 100%;
119
+ }
120
+
121
+
122
+ .srcker-html-content.light blockquote {
123
+ color: #555;
124
+ background: rgba(0, 0, 0, 0.02);
125
+ }
126
+
127
+ .srcker-html-content.light code {
128
+ background: #f0f0f0;
129
+ color: #c7254e;
130
+ }
131
+
132
+ .srcker-html-content.light pre {
133
+ background: #f6f8fa;
134
+ color: #24292e;
135
+ }
136
+
137
+ .srcker-html-content.light hr {
138
+ border-top-color: rgba(0, 0, 0, 0.12);
139
+ }
140
+
141
+
142
+ .srcker-html-content.dark blockquote {
143
+ color: #aaa;
144
+ }
145
+
146
+ .srcker-html-content.dark code {
147
+ background: #333;
148
+ color: #fff;
149
+ }
150
+
151
+ .srcker-html-content.dark pre {
152
+ background: #000;
153
+ color: #fff;
154
+ }
155
+
156
+ .srcker-html-content.dark hr {
157
+ border-top-color: rgba(255, 255, 255, 0.15);
158
+ }
@@ -0,0 +1,175 @@
1
+ .srcker-html-content{
2
+ outline: none;
3
+ min-height: 100%;
4
+ font-size: 16px;
5
+ line-height: 1.6;
6
+ color: var(--color);
7
+ background: var(--background);
8
+
9
+ .is-focused{
10
+ background: var(--hover-background);
11
+ }
12
+
13
+ p.is-editor-empty:first-child::before {
14
+ color: #888;
15
+ content: attr(data-placeholder);
16
+ float: left;
17
+ height: 0;
18
+ pointer-events: none;
19
+ }
20
+
21
+ ul,
22
+ ol {
23
+ padding-left: 1.5rem;
24
+ margin: 0.5rem 0;
25
+
26
+ &[style*="list-style-type"] {
27
+ padding-left: 40px !important;
28
+ }
29
+
30
+ li {
31
+ padding: 0;
32
+ margin: 0;
33
+ }
34
+ }
35
+
36
+ blockquote {
37
+ border-left: 3px solid var(--border-color);
38
+ margin: 1rem 0;
39
+ padding-left: 1rem;
40
+ font-style: italic;
41
+ color: #555;
42
+ background: rgba(0, 0, 0, 0.02);
43
+ }
44
+
45
+ code {
46
+ background: #f0f0f0;
47
+ color: #c7254e;
48
+ border-radius: 4px;
49
+ font-size: 12px;
50
+ padding: 0.25em 0.3em;
51
+ font-family: 'JetBrainsMono', monospace;
52
+ }
53
+
54
+ pre {
55
+ background: #000;
56
+ border-radius: 5px;
57
+ color: #fff;
58
+ font-family: 'JetBrainsMono', monospace;
59
+ margin: 15px 0;
60
+ padding: 5px 10px;
61
+
62
+ code {
63
+ background: none;
64
+ color: inherit;
65
+ font-size: 12px;
66
+ padding: 0;
67
+ }
68
+ }
69
+
70
+ hr {
71
+ border: none;
72
+ border-top: 1px solid #ccc;
73
+ margin: 20px 0;
74
+ }
75
+
76
+ a {
77
+ color: #1890ff;
78
+ text-decoration: underline;
79
+ cursor: pointer;
80
+ }
81
+
82
+ h1,
83
+ h2,
84
+ h3,
85
+ h4,
86
+ h5,
87
+ h6 {
88
+ margin-top: 1em;
89
+ margin-bottom: 0.5em;
90
+ line-height: 1.3;
91
+ padding-left: 0 !important;
92
+ }
93
+
94
+ img.resizable-image {
95
+ cursor: pointer;
96
+ transition: opacity 0.2s;
97
+ }
98
+
99
+ img.resizable-image:hover {
100
+ opacity: 0.8;
101
+ }
102
+
103
+ &.light {
104
+ --color: #1f1f1f;
105
+ --background: #ffffff;
106
+
107
+ --border-color: rgba(0, 0, 0, 0.1);
108
+
109
+ --active-color: #1677ff;
110
+ --active-background: #e6f4ff;
111
+
112
+ --hover-color: #555;
113
+ --hover-background: rgba(0, 0, 0, 0.05);
114
+
115
+ --disabled-color: rgba(0, 0, 0, 0.4);
116
+ --disabled-background: #f5f5f5;
117
+
118
+ blockquote {
119
+ color: #555;
120
+ background: rgba(0, 0, 0, 0.02);
121
+ }
122
+
123
+ code {
124
+ background: #f0f0f0;
125
+ color: #c7254e;
126
+ }
127
+
128
+ pre {
129
+ background: #f6f8fa;
130
+ color: #24292e;
131
+ }
132
+
133
+ hr {
134
+ border-top-color: rgba(0, 0, 0, 0.12);
135
+ }
136
+ }
137
+
138
+ &.dark {
139
+ --color: rgba(255, 255, 255, 0.9);
140
+ --background: #0e0e11;
141
+
142
+ --border-color: rgba(255, 255, 255, 0.1);
143
+
144
+ --active-color: #226bf0;
145
+ --active-background: rgba(255, 255, 255, 0.08);
146
+
147
+ --hover-color: #aaa;
148
+ --hover-background: rgba(255, 255, 255, 0.1);
149
+
150
+ --disabled-color: rgba(255, 255, 255, 0.4);
151
+ --disabled-background: rgba(255, 255, 255, 0.05);
152
+
153
+ blockquote {
154
+ color: #aaa;
155
+ }
156
+
157
+ code {
158
+ background: #333;
159
+ color: #fff;
160
+ }
161
+
162
+ pre {
163
+ background: #000;
164
+ color: #fff;
165
+ }
166
+
167
+ hr {
168
+ border-top-color: rgba(255, 255, 255, 0.15);
169
+ }
170
+ }
171
+ }
172
+
173
+ .srcker-html-content img {
174
+ max-width: 100%;
175
+ }
package/src/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/src/types.ts ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 上传返回结构
3
+ */
4
+ export interface UploadImageResult {
5
+ url: string
6
+ name?: string
7
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "jsx": "preserve",
8
+ "skipLibCheck": true,
9
+ "baseUrl": "."
10
+ },
11
+ "include": [
12
+ "src/**/*.ts",
13
+ "src/**/*.tsx",
14
+ "src/**/*.vue"
15
+ ]
16
+ }
17
+
package/vite.config.ts ADDED
@@ -0,0 +1,29 @@
1
+ import { fileURLToPath, URL } from 'node:url'
2
+ import { defineConfig } from 'vite'
3
+ import vue from '@vitejs/plugin-vue'
4
+ import vueDevTools from 'vite-plugin-vue-devtools'
5
+ import path from 'path'
6
+
7
+ export default defineConfig({
8
+ plugins: [vue()],
9
+ build: {
10
+ lib: {
11
+ entry: path.resolve(__dirname, 'src/index.ts'),
12
+ name: 'RichEditor',
13
+ fileName: (format) => `rich-editor.${format}.js`
14
+ },
15
+ resolve: {
16
+ alias: {
17
+ '@': path.resolve(__dirname, 'src') // 让 Rollup 识别 @
18
+ }
19
+ },
20
+ rollupOptions: {
21
+ external: ['vue'],
22
+ output: {
23
+ globals: {
24
+ vue: 'Vue'
25
+ }
26
+ }
27
+ }
28
+ }
29
+ })