@zipify/wysiwyg 1.0.0-dev.1 → 1.0.0-dev.2
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/.env.example +1 -0
- package/.release-it.json +9 -0
- package/README.md +129 -11
- package/lib/Wysiwyg.vue +1 -2
- package/package.json +4 -2
package/.env.example
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
GITHUB_RELEASE_TOKEN=github_personal_access_token
|
package/.release-it.json
CHANGED
package/README.md
CHANGED
|
@@ -10,20 +10,19 @@ npm install @zipify/wysiwyg @vue/composition-api
|
|
|
10
10
|
# if yarn
|
|
11
11
|
yarn add @zipify/wysiwyg @vue/composition-api
|
|
12
12
|
```
|
|
13
|
-
2.
|
|
14
|
-
```js
|
|
15
|
-
import Vue from 'vue';
|
|
16
|
-
import VueCompositionAPI from '@vue/composition-api';
|
|
13
|
+
2. Use editor
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
3. Use editor
|
|
21
|
-
|
|
22
|
-
For more details see [example app](/example)
|
|
15
|
+
For more details see [available options](#Options) and [example app](/example)
|
|
23
16
|
```vue
|
|
24
17
|
|
|
25
18
|
<template>
|
|
26
|
-
<Wysiwyg
|
|
19
|
+
<Wysiwyg
|
|
20
|
+
v-model="content"
|
|
21
|
+
:fonts="fonts"
|
|
22
|
+
:presets="presets"
|
|
23
|
+
:make-preset-variable="$options.makePresetVariable"
|
|
24
|
+
default-preset-id="regular-1"
|
|
25
|
+
/>
|
|
27
26
|
</template>
|
|
28
27
|
|
|
29
28
|
<script>
|
|
@@ -32,16 +31,135 @@ import { Wysiwyg } from '@zipify/wysiwyg';
|
|
|
32
31
|
export default {
|
|
33
32
|
components: { Wysiwyg },
|
|
34
33
|
|
|
34
|
+
makePresetVariable: ({ preset, device, property }) => {
|
|
35
|
+
return `--${preset.id}-${device}-${property}`;
|
|
36
|
+
},
|
|
37
|
+
|
|
35
38
|
data: () => ({
|
|
36
39
|
content: {
|
|
37
40
|
type: 'doc',
|
|
38
41
|
content: [...]
|
|
39
|
-
}
|
|
42
|
+
},
|
|
43
|
+
presets: [...],
|
|
44
|
+
fonts: [...]
|
|
40
45
|
})
|
|
41
46
|
}
|
|
42
47
|
</script>
|
|
43
48
|
```
|
|
44
49
|
|
|
50
|
+
## Options
|
|
51
|
+
|
|
52
|
+
### Props
|
|
53
|
+
|
|
54
|
+
| Name | Required? | Default Value | Note |
|
|
55
|
+
|:--------------------:|:---------:|:-------------:|----------------------------------------------------------------|
|
|
56
|
+
| value | true | - | |
|
|
57
|
+
| presets | true | - | Array of [Style-Presets](#Style-Preset) |
|
|
58
|
+
| default-preset-id | true | - | Id of any preset |
|
|
59
|
+
| make-preset-variable | true | - | [Generates](#Generate-Preset-Variable) name of preset variable |
|
|
60
|
+
| fonts | true | - | Array of [fonts](#Font) |
|
|
61
|
+
| device | false | `'desktop'` | Active device type. can be 'mobile', 'tablet' or 'desktop' |
|
|
62
|
+
| favorite-colors | false | [] | List of favorite colors in color picker |
|
|
63
|
+
| toolbar-offsets | false | `[0, 8]` | Offset between toolbar and content |
|
|
64
|
+
| base-list-class | false | `'zw-list--'` | Base list class |
|
|
65
|
+
|
|
66
|
+
### Style Preset
|
|
67
|
+
Represents available font family. Required interface
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
interface StylePreset {
|
|
71
|
+
id: string | number;
|
|
72
|
+
name: string;
|
|
73
|
+
hidden: boolean;
|
|
74
|
+
node?: PresetNode;
|
|
75
|
+
common: CommonSettings;
|
|
76
|
+
desktop: DeviceSettings;
|
|
77
|
+
tablet: DeviceSettings;
|
|
78
|
+
mobile: DeviceSettings;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface PresetNode {
|
|
82
|
+
type: 'heading';
|
|
83
|
+
level: 1 | 2 | 3 | 4;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface CommonSettings {
|
|
87
|
+
font_family: string;
|
|
88
|
+
font_weight: string;
|
|
89
|
+
color: string;
|
|
90
|
+
font_style: 'italic' | 'normal';
|
|
91
|
+
text_decoration: 'none' | 'underscore';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
interface DeviceSettings {
|
|
95
|
+
alignment: 'left' | 'center' | 'right' | 'justify';
|
|
96
|
+
line_height: string;
|
|
97
|
+
font_size: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const example: StylePreset = {
|
|
101
|
+
id: 'h1',
|
|
102
|
+
name: 'H1',
|
|
103
|
+
node: {
|
|
104
|
+
type: 'heading',
|
|
105
|
+
level: 1
|
|
106
|
+
},
|
|
107
|
+
desktop: {
|
|
108
|
+
alignment: 'left',
|
|
109
|
+
line_height: '1.2',
|
|
110
|
+
font_size: '40px'
|
|
111
|
+
},
|
|
112
|
+
common: {
|
|
113
|
+
font_family: 'Lato',
|
|
114
|
+
font_weight: '700',
|
|
115
|
+
color: '#262626',
|
|
116
|
+
font_style: 'normal',
|
|
117
|
+
text_decoration: 'none'
|
|
118
|
+
},
|
|
119
|
+
tablet: {
|
|
120
|
+
alignment: 'left',
|
|
121
|
+
line_height: '1.2',
|
|
122
|
+
font_size: '40px'
|
|
123
|
+
},
|
|
124
|
+
mobile: {
|
|
125
|
+
alignment: 'left',
|
|
126
|
+
line_height: '1.2',
|
|
127
|
+
font_size: '28px'
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Generate Preset Variable
|
|
133
|
+
Variable name generator uses follow iterface
|
|
134
|
+
```typescript
|
|
135
|
+
const Device = 'common' | 'mobile' | 'tablet' | 'desktop'
|
|
136
|
+
|
|
137
|
+
interface VariableGeneratorOptions {
|
|
138
|
+
preset: StylePreset;
|
|
139
|
+
device: Device;
|
|
140
|
+
property: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
type GeneratePresetVariable = (options: VariableGeneratorOptions) => string;
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Font
|
|
147
|
+
Represents available font family. Required interface
|
|
148
|
+
```typescript
|
|
149
|
+
interface Font {
|
|
150
|
+
name: string;
|
|
151
|
+
category: string;
|
|
152
|
+
styles: string[];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const exmaple: Font = {
|
|
156
|
+
name: 'Roboto',
|
|
157
|
+
styles: ['300', '300i', '400', '400i', '700', '700i'],
|
|
158
|
+
category: 'Regular'
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
|
|
45
163
|
## Contribute
|
|
46
164
|
1. Clone repository
|
|
47
165
|
```shell
|
package/lib/Wysiwyg.vue
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zipify/wysiwyg",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.2",
|
|
4
4
|
"description": "Zipify modification of TipTap text editor",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"test:unit": "jest .",
|
|
20
20
|
"optimize-svg": "svgo --config ./config/svgo.js",
|
|
21
21
|
"gzip": "gzipper compress",
|
|
22
|
-
"prepare": "husky install"
|
|
22
|
+
"prepare": "husky install",
|
|
23
|
+
"release": "export $(cat ./.env | xargs) && release-it"
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
25
26
|
"@popperjs/core": "^2.11.5",
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
"jest-environment-jsdom": "^28.1.3",
|
|
61
62
|
"lint-staged": "^13.0.3",
|
|
62
63
|
"postcss-html": "^1.5.0",
|
|
64
|
+
"release-it": "^15.1.2",
|
|
63
65
|
"style-loader": "^3.3.1",
|
|
64
66
|
"stylelint": "^14.9.1",
|
|
65
67
|
"svgo": "^2.8.0",
|