Skip to content

Commit 4f13607

Browse files
committed
Merge branch 'develop' into 9.6.0
2 parents b4c713b + 7a0b951 commit 4f13607

File tree

80 files changed

+5512
-932
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+5512
-932
lines changed

docs/styleGuide.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
#### Component
66

77
1. Must be written following the kebab-case style;
8-
1. Must be prefixed with `kup-`.
8+
2. Must be prefixed with `kup-`.
9+
3. Being a web component, it must include a Shadow DOM.
910

1011
#### Interfaces and enums
1112

packages/ketchup-react/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export const KupDialog = /*@__PURE__*/createReactComponent<JSX.KupDialog, HTMLKu
3232
export const KupDrawer = /*@__PURE__*/createReactComponent<JSX.KupDrawer, HTMLKupDrawerElement>('kup-drawer');
3333
export const KupDropdownButton = /*@__PURE__*/createReactComponent<JSX.KupDropdownButton, HTMLKupDropdownButtonElement>('kup-dropdown-button');
3434
export const KupEchart = /*@__PURE__*/createReactComponent<JSX.KupEchart, HTMLKupEchartElement>('kup-echart');
35+
export const KupEditor = /*@__PURE__*/createReactComponent<JSX.KupEditor, HTMLKupEditorElement>('kup-editor');
3536
export const KupFamilyTree = /*@__PURE__*/createReactComponent<JSX.KupFamilyTree, HTMLKupFamilyTreeElement>('kup-family-tree');
3637
export const KupForm = /*@__PURE__*/createReactComponent<JSX.KupForm, HTMLKupFormElement>('kup-form');
3738
export const KupGantt = /*@__PURE__*/createReactComponent<JSX.KupGantt, HTMLKupGanttElement>('kup-gantt');

packages/ketchup-showcase/src/App.vue

+10
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,16 @@ export default {
365365
value: 'EChart',
366366
visible: true,
367367
},
368+
{
369+
cells: {
370+
ROUTE: {
371+
value: 'editor',
372+
},
373+
},
374+
icon: 'mode_edit',
375+
value: 'Editor',
376+
visible: true,
377+
},
368378
{
369379
cells: {
370380
ROUTE: {

packages/ketchup-showcase/src/plugins/router.ts

+5
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ const advancedRoutes = [
250250
name: 'planner',
251251
component: () => import(`@/views/components/advanced/planner/Planner.vue`),
252252
},
253+
{
254+
path: `/editor`,
255+
name: 'editor',
256+
component: () => import(`@/views/components/advanced/editor/Editor.vue`),
257+
},
253258
];
254259

255260
const thirdPartiesRoutes = [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<template>
2+
<div>
3+
<comp :giturl="giturl" :headtitle="headtitle" :titles="titles">
4+
<template v-slot:0>
5+
<editor-demo></editor-demo>
6+
</template>
7+
<template v-slot:1>
8+
<editor-basic></editor-basic>
9+
</template>
10+
</comp>
11+
</div>
12+
</template>
13+
14+
<script>
15+
import Comp from '@/views/templates/Comp';
16+
import EditorDemo from './examples/EditorDemo';
17+
import EditorBasic from './examples/EditorBasic';
18+
19+
export default {
20+
components: {
21+
EditorDemo,
22+
EditorBasic,
23+
Comp,
24+
},
25+
26+
data() {
27+
return {
28+
giturl:
29+
'https://github.com/smeup/ketchup/tree/develop/packages/ketchup/src/components/kup-editor',
30+
headtitle: 'Editor',
31+
titles: ['Playground', 'Basic Usage'],
32+
};
33+
},
34+
title: 'Ketchup | Editor',
35+
};
36+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<template>
2+
<div>
3+
<div class="demo-wrapper">
4+
<p
5+
>The Editor component provides a streamlined solution for creating and
6+
editing text. It offers a user-friendly interface, making text
7+
manipulation straightforward and efficient.</p
8+
>
9+
<div class="demo-container">
10+
<p class="centered">Sample markup</p>
11+
<code class="flat">{{ markupBasic }}</code>
12+
</div>
13+
</div>
14+
</div>
15+
</template>
16+
17+
<script>
18+
export default {
19+
name: 'EditorBasic',
20+
data() {
21+
return {
22+
markupBasic: '<kup-editor></kup-editor>',
23+
};
24+
},
25+
};
26+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
<template>
2+
<div>
3+
<demo
4+
:demoComp="demoComp"
5+
:demoEvents="demoEvents"
6+
:demoMethods="demoMethods"
7+
:demoProps="demoProps"
8+
></demo>
9+
</div>
10+
</template>
11+
12+
<script>
13+
import Demo from '@/views/templates/Demo';
14+
15+
export default {
16+
components: {
17+
Demo,
18+
},
19+
name: 'EditorDemo',
20+
data() {
21+
return {
22+
demoComp: createComp(),
23+
demoEvents: [
24+
{
25+
name: 'kup-editor-autosave',
26+
type: 'CustomEvent',
27+
},
28+
{
29+
name: 'kup-editor-ready',
30+
type: 'CustomEvent',
31+
},
32+
{
33+
name: 'kup-editor-save',
34+
type: 'CustomEvent',
35+
},
36+
],
37+
demoMethods: [
38+
{
39+
name: 'getProps',
40+
description:
41+
"Returns the props' values of the component. When invoked giving true as the only argument, returns the props descriptions instead.",
42+
},
43+
{
44+
name: 'getValueAsHTML',
45+
description: `Returns the component's internal value as html.`,
46+
},
47+
{
48+
name: 'getValueAsMarkdown',
49+
description: `Returns the component's internal value as markdown.`,
50+
},
51+
{
52+
name: 'refresh',
53+
description:
54+
'This method is used to trigger a new render of the component.',
55+
},
56+
{
57+
name: 'setProps',
58+
description: 'Sets the props to the component.',
59+
},
60+
],
61+
demoProps: [
62+
{
63+
prop: 'autosaveTimer',
64+
description:
65+
'When specified, the component will emit the kup-editor-save event at regular intervals.',
66+
type: 'number',
67+
default: 'undefined',
68+
try: 'field',
69+
},
70+
{
71+
prop: 'editorHeight',
72+
description: 'Sets the height of the component.',
73+
type: 'string',
74+
default: '"auto"',
75+
try: 'field',
76+
},
77+
{
78+
prop: 'initialEditType',
79+
description:
80+
'The editor type. Supported values: "markdown", "wysiwyg".',
81+
type: 'KupEditorType',
82+
default: 'markdown',
83+
try: 'field',
84+
},
85+
{
86+
prop: 'initialValue',
87+
description: 'The initial editor value.',
88+
type: 'string',
89+
default: '""',
90+
try: 'field',
91+
},
92+
{
93+
prop: 'isReadOnly',
94+
description: 'Defines whether the editor is disabled or not.',
95+
type: 'boolean',
96+
default: 'false',
97+
try: 'switch',
98+
},
99+
{
100+
prop: 'previewStyle',
101+
description:
102+
'The editor preview style. Supported values: "tab", "vertical".',
103+
type: 'KupEditorPreview',
104+
default: 'vertical',
105+
try: 'field',
106+
},
107+
{
108+
prop: 'showSaveButton',
109+
description: `Defines whether to show the save button in editor's toolbar or not.`,
110+
type: 'boolean',
111+
default: 'true',
112+
try: 'switch',
113+
},
114+
{
115+
prop: 'showToolbar',
116+
description: `Defines whether to show the editor's toolbar or not.`,
117+
type: 'string',
118+
default: 'boolean',
119+
try: 'switch',
120+
},
121+
],
122+
};
123+
},
124+
};
125+
126+
function createComp() {
127+
const comp = document.createElement('kup-editor');
128+
comp.id = 'demo-component';
129+
130+
comp.initialEditType = 'markdown';
131+
comp.initialValue = `<p><img src="https://uicdn.toast.com/toastui/img/tui-editor-bi.png" alt="image"></p>
132+
<h1>Awesome Editor!</h1>
133+
<p>It has been <em>released as opensource in 2018</em> and has <del>continually</del> evolved to <strong>receive 10k GitHub ⭐️ Stars</strong>.</p>
134+
<h2>Create Instance</h2>
135+
<p>You can create an instance with the following code and use <code data-backticks="1">getHtml()</code> and <code data-backticks="1">getMarkdown()</code> of the <a href="https://github.com/nhn/tui.editor">Editor</a>.</p>
136+
<pre class="lang-js"><code data-language="js">co
137+
138+
&gt; See the table below for default options
139+
&gt; &gt; More API information can be found in the document
140+
141+
| name | type | description |
142+
| --- | --- | --- |
143+
| el | HTMLElement | container element |
144+
145+
## Featuress
146+
147+
* CommonMark + GFM Specifications
148+
* Live Preview
149+
* Scroll Sync
150+
* Auto Indent
151+
* Syntax Highlight
152+
1. Markdown
153+
2. Preview
154+
155+
## Support Wrappers
156+
157+
&gt; * Wrappers
158+
&gt; 1. [x] React
159+
&gt; 2. [x] Vue
160+
&gt; 3. [ ] Ember&lt;p&gt;My Custom value for editor&lt;/p&gt;
161+
</code></pre>
162+
`;
163+
comp.isReadOnly = false;
164+
comp.previewStyle = 'vertical';
165+
comp.showSaveButton = true;
166+
comp.showToolbar = true;
167+
168+
return comp;
169+
}
170+
</script>

packages/ketchup/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"@material/form-field": "^14.0.0",
4747
"@material/ripple": "^14.0.0",
4848
"@material/textfield": "^14.0.0",
49+
"@toast-ui/editor": "^2.5.4",
4950
"d3-shape": "^3.2.0",
5051
"dayjs": "^1.11.7",
5152
"echarts": "^5.4.2",
@@ -58,9 +59,9 @@
5859
"vanilla-picker": "^2.12.1"
5960
},
6061
"devDependencies": {
61-
"@stencil/core": "^4.8.1",
62+
"@stencil/core": "^4.12.0",
6263
"@stencil/react-output-target": "0.5.3",
63-
"@stencil/sass": "^3.0.7",
64+
"@stencil/sass": "^3.0.9",
6465
"jest": "^29.7.0",
6566
"jest-cli": "^29.7.0",
6667
"jest-html-reporter": "^3.10.2",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
let comp = document.getElementById('editor-html');
2+
3+
comp.addEventListener('kup-editor-autosave', (e) => {
4+
console.log('kup-editor-autosave (html) ' + new Date().toISOString(), e);
5+
});
6+
7+
let props = {
8+
customStyle: '',
9+
editorHeight: '400px',
10+
initialEditType: 'wysiwyg',
11+
initialValue:
12+
'<div data-tomark-pass="">prova prova 123456 56<br></div><div data-tomark-pass=""><br></div><div data-tomark-pass="">e vado a capo<br></div><div data-tomark-pass=""><br></div><div data-tomark-pass="">ancora<br></div><div data-tomark-pass=""><br></div><div data-tomark-pass="">e ancora</div>',
13+
isReadOnly: false,
14+
previewStyle: 'tab',
15+
showSaveButton: true,
16+
showToolbar: true,
17+
autosaveTimer: 5000,
18+
};
19+
20+
if (props) {
21+
for (const key in props) {
22+
comp[key] = props[key];
23+
}
24+
}
25+
26+
comp = document.getElementById('editor-markdown');
27+
28+
comp.addEventListener('kup-editor-autosave', (e) => {
29+
console.log(
30+
'kup-editor-autosave (markdown) ' + new Date().toISOString(),
31+
e
32+
);
33+
});
34+
35+
props = {
36+
customStyle: '',
37+
initialEditType: 'markdown',
38+
initialValue: '# title 1 \n ## title2',
39+
isReadOnly: false,
40+
previewStyle: 'tab',
41+
showSaveButton: false,
42+
showToolbar: true,
43+
autosaveTimer: 5000,
44+
};
45+
46+
comp.style = '--kup-editor-height: 300px;';
47+
48+
if (props) {
49+
for (const key in props) {
50+
comp[key] = props[key];
51+
}
52+
}

0 commit comments

Comments
 (0)