Skip to content

Commit

Permalink
Merge pull request #1777 from smeup/9.6.0
Browse files Browse the repository at this point in the history
9.6.0
  • Loading branch information
pasere-smeup authored Feb 7, 2024
2 parents b4c713b + f807b81 commit ef2658c
Show file tree
Hide file tree
Showing 88 changed files with 5,581 additions and 971 deletions.
3 changes: 2 additions & 1 deletion docs/styleGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#### Component

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

#### Interfaces and enums

Expand Down
4 changes: 2 additions & 2 deletions packages/ketchup-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sme.up/ketchup-react",
"version": "9.5.2",
"version": "9.6.0",
"module": "dist/index.js",
"typings": "dist/index.d.ts",
"keywords": [
Expand All @@ -20,7 +20,7 @@
"description": "Ketchup React Components library by smeup",
"license": "Apache-2.0",
"dependencies": {
"@sme.up/ketchup": "^9.5.2",
"@sme.up/ketchup": "^9.6.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
1 change: 1 addition & 0 deletions packages/ketchup-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const KupDialog = /*@__PURE__*/createReactComponent<JSX.KupDialog, HTMLKu
export const KupDrawer = /*@__PURE__*/createReactComponent<JSX.KupDrawer, HTMLKupDrawerElement>('kup-drawer');
export const KupDropdownButton = /*@__PURE__*/createReactComponent<JSX.KupDropdownButton, HTMLKupDropdownButtonElement>('kup-dropdown-button');
export const KupEchart = /*@__PURE__*/createReactComponent<JSX.KupEchart, HTMLKupEchartElement>('kup-echart');
export const KupEditor = /*@__PURE__*/createReactComponent<JSX.KupEditor, HTMLKupEditorElement>('kup-editor');
export const KupFamilyTree = /*@__PURE__*/createReactComponent<JSX.KupFamilyTree, HTMLKupFamilyTreeElement>('kup-family-tree');
export const KupForm = /*@__PURE__*/createReactComponent<JSX.KupForm, HTMLKupFormElement>('kup-form');
export const KupGantt = /*@__PURE__*/createReactComponent<JSX.KupGantt, HTMLKupGanttElement>('kup-gantt');
Expand Down
2 changes: 1 addition & 1 deletion packages/ketchup-showcase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"@sme.up/ketchup": "^9.5.2",
"@sme.up/ketchup": "^9.6.0",
"core-js": "^3.30.2",
"vue": "^2.6.14",
"vue-router": "^3.5.1"
Expand Down
14 changes: 12 additions & 2 deletions packages/ketchup-showcase/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
@kup-tree-nodeselected="treeClick"
></kup-tree
><div class="version"
><a href="https://github.com/smeup/ketchup/releases/tag/v9.5.2"
>v9.5.2</a
><a href="https://github.com/smeup/ketchup/releases/tag/v9.6.0"
>v9.6.0</a
></div
></div
>
Expand Down Expand Up @@ -365,6 +365,16 @@ export default {
value: 'EChart',
visible: true,
},
{
cells: {
ROUTE: {
value: 'editor',
},
},
icon: 'mode_edit',
value: 'Editor',
visible: true,
},
{
cells: {
ROUTE: {
Expand Down
5 changes: 5 additions & 0 deletions packages/ketchup-showcase/src/plugins/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ const advancedRoutes = [
name: 'planner',
component: () => import(`@/views/components/advanced/planner/Planner.vue`),
},
{
path: `/editor`,
name: 'editor',
component: () => import(`@/views/components/advanced/editor/Editor.vue`),
},
];

const thirdPartiesRoutes = [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<template>
<div>
<comp :giturl="giturl" :headtitle="headtitle" :titles="titles">
<template v-slot:0>
<editor-demo></editor-demo>
</template>
<template v-slot:1>
<editor-basic></editor-basic>
</template>
</comp>
</div>
</template>

<script>
import Comp from '@/views/templates/Comp';
import EditorDemo from './examples/EditorDemo';
import EditorBasic from './examples/EditorBasic';
export default {
components: {
EditorDemo,
EditorBasic,
Comp,
},
data() {
return {
giturl:
'https://github.com/smeup/ketchup/tree/develop/packages/ketchup/src/components/kup-editor',
headtitle: 'Editor',
titles: ['Playground', 'Basic Usage'],
};
},
title: 'Ketchup | Editor',
};
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<template>
<div>
<div class="demo-wrapper">
<p
>The Editor component provides a streamlined solution for creating and
editing text. It offers a user-friendly interface, making text
manipulation straightforward and efficient.</p
>
<div class="demo-container">
<p class="centered">Sample markup</p>
<code class="flat">{{ markupBasic }}</code>
</div>
</div>
</div>
</template>

<script>
export default {
name: 'EditorBasic',
data() {
return {
markupBasic: '<kup-editor></kup-editor>',
};
},
};
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
<template>
<div>
<demo
:demoComp="demoComp"
:demoEvents="demoEvents"
:demoMethods="demoMethods"
:demoProps="demoProps"
></demo>
</div>
</template>

<script>
import Demo from '@/views/templates/Demo';
export default {
components: {
Demo,
},
name: 'EditorDemo',
data() {
return {
demoComp: createComp(),
demoEvents: [
{
name: 'kup-editor-autosave',
type: 'CustomEvent',
},
{
name: 'kup-editor-ready',
type: 'CustomEvent',
},
{
name: 'kup-editor-save',
type: 'CustomEvent',
},
],
demoMethods: [
{
name: 'getProps',
description:
"Returns the props' values of the component. When invoked giving true as the only argument, returns the props descriptions instead.",
},
{
name: 'getValueAsHTML',
description: `Returns the component's internal value as html.`,
},
{
name: 'getValueAsMarkdown',
description: `Returns the component's internal value as markdown.`,
},
{
name: 'refresh',
description:
'This method is used to trigger a new render of the component.',
},
{
name: 'setProps',
description: 'Sets the props to the component.',
},
],
demoProps: [
{
prop: 'autosaveTimer',
description:
'When specified, the component will emit the kup-editor-save event at regular intervals.',
type: 'number',
default: 'undefined',
try: 'field',
},
{
prop: 'editorHeight',
description: 'Sets the height of the component.',
type: 'string',
default: '"auto"',
try: 'field',
},
{
prop: 'initialEditType',
description:
'The editor type. Supported values: "markdown", "wysiwyg".',
type: 'KupEditorType',
default: 'markdown',
try: 'field',
},
{
prop: 'initialValue',
description: 'The initial editor value.',
type: 'string',
default: '""',
try: 'field',
},
{
prop: 'isReadOnly',
description: 'Defines whether the editor is disabled or not.',
type: 'boolean',
default: 'false',
try: 'switch',
},
{
prop: 'previewStyle',
description:
'The editor preview style. Supported values: "tab", "vertical".',
type: 'KupEditorPreview',
default: 'vertical',
try: 'field',
},
{
prop: 'showSaveButton',
description: `Defines whether to show the save button in editor's toolbar or not.`,
type: 'boolean',
default: 'true',
try: 'switch',
},
{
prop: 'showToolbar',
description: `Defines whether to show the editor's toolbar or not.`,
type: 'string',
default: 'boolean',
try: 'switch',
},
],
};
},
};
function createComp() {
const comp = document.createElement('kup-editor');
comp.id = 'demo-component';
comp.initialEditType = 'markdown';
comp.initialValue = `<p><img src="https://uicdn.toast.com/toastui/img/tui-editor-bi.png" alt="image"></p>
<h1>Awesome Editor!</h1>
<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>
<h2>Create Instance</h2>
<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>
<pre class="lang-js"><code data-language="js">co
&gt; See the table below for default options
&gt; &gt; More API information can be found in the document
| name | type | description |
| --- | --- | --- |
| el | HTMLElement | container element |
## Featuress
* CommonMark + GFM Specifications
* Live Preview
* Scroll Sync
* Auto Indent
* Syntax Highlight
1. Markdown
2. Preview
## Support Wrappers
&gt; * Wrappers
&gt; 1. [x] React
&gt; 2. [x] Vue
&gt; 3. [ ] Ember&lt;p&gt;My Custom value for editor&lt;/p&gt;
</code></pre>
`;
comp.isReadOnly = false;
comp.previewStyle = 'vertical';
comp.showSaveButton = true;
comp.showToolbar = true;
return comp;
}
</script>
7 changes: 4 additions & 3 deletions packages/ketchup/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sme.up/ketchup",
"version": "9.5.2",
"version": "9.6.0",
"keywords": [
"smeup",
"KetchUP",
Expand Down Expand Up @@ -46,6 +46,7 @@
"@material/form-field": "^14.0.0",
"@material/ripple": "^14.0.0",
"@material/textfield": "^14.0.0",
"@toast-ui/editor": "^2.5.4",
"d3-shape": "^3.2.0",
"dayjs": "^1.11.7",
"echarts": "^5.4.2",
Expand All @@ -58,9 +59,9 @@
"vanilla-picker": "^2.12.1"
},
"devDependencies": {
"@stencil/core": "^4.8.1",
"@stencil/core": "^4.12.0",
"@stencil/react-output-target": "0.5.3",
"@stencil/sass": "^3.0.7",
"@stencil/sass": "^3.0.9",
"jest": "^29.7.0",
"jest-cli": "^29.7.0",
"jest-html-reporter": "^3.10.2",
Expand Down
52 changes: 52 additions & 0 deletions packages/ketchup/src/assets/editor-example-1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
let comp = document.getElementById('editor-html');

comp.addEventListener('kup-editor-autosave', (e) => {
console.log('kup-editor-autosave (html) ' + new Date().toISOString(), e);
});

let props = {
customStyle: '',
editorHeight: '400px',
initialEditType: 'wysiwyg',
initialValue:
'<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>',
isReadOnly: false,
previewStyle: 'tab',
showSaveButton: true,
showToolbar: true,
autosaveTimer: 5000,
};

if (props) {
for (const key in props) {
comp[key] = props[key];
}
}

comp = document.getElementById('editor-markdown');

comp.addEventListener('kup-editor-autosave', (e) => {
console.log(
'kup-editor-autosave (markdown) ' + new Date().toISOString(),
e
);
});

props = {
customStyle: '',
initialEditType: 'markdown',
initialValue: '# title 1 \n ## title2',
isReadOnly: false,
previewStyle: 'tab',
showSaveButton: false,
showToolbar: true,
autosaveTimer: 5000,
};

comp.style = '--kup-editor-height: 300px;';

if (props) {
for (const key in props) {
comp[key] = props[key];
}
}
Loading

0 comments on commit ef2658c

Please sign in to comment.