├── .github └── workflows │ ├── shipjs-manual-prepare.yml │ ├── shipjs-trigger.yml │ └── test.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── babel.config.js ├── config ├── rollup │ └── rollup.config.js └── webpack │ └── site │ ├── webpack.base.conf.js │ ├── webpack.dev.conf.js │ └── webpack.publish.conf.js ├── docs ├── 152.js ├── 152.js.LICENSE.txt ├── 397.js ├── check-lists.js ├── editable-voids.js ├── embeds.js ├── forced-layout.js ├── hovering-toolbar.js ├── hugeDocument.js ├── images.js ├── index.html ├── links.js ├── main.js ├── main.js.LICENSE.txt ├── markdown-preview.js ├── markdown-shortcuts.js ├── mentions.js ├── paste-html.js ├── paste-html.js.LICENSE.txt ├── plaintext.js ├── readonly.js ├── richtext.js ├── search-highlighting.js ├── table.js ├── vendors~hugeDocument.js └── vendors~markdown-preview.js ├── jest.config.js ├── lerna.json ├── package.json ├── packages ├── slate-vue-shared │ ├── README.md │ ├── components │ │ ├── editable.ts │ │ └── index.ts │ ├── index.ts │ ├── package.json │ ├── plugins │ │ ├── index.ts │ │ ├── runtime-util.ts │ │ ├── vue-editor-runtime.ts │ │ ├── vue-editor.ts │ │ ├── vue-runtime.ts │ │ └── with-vue.ts │ ├── tsconfig.json │ ├── types │ │ └── index.ts │ └── utils │ │ ├── beforeInput.ts │ │ ├── dom.ts │ │ ├── environment.ts │ │ ├── hotkeys.ts │ │ ├── index.ts │ │ ├── key.ts │ │ └── weak-maps.ts └── slate-vue │ ├── README.md │ ├── __test__ │ └── base.spec.js │ ├── components │ ├── children.tsx │ ├── editable.tsx │ ├── element.tsx │ ├── fragment.tsx │ ├── leaf.tsx │ ├── slate.tsx │ ├── string.tsx │ └── text.tsx │ ├── index.ts │ ├── package.json │ ├── plugins │ ├── index.ts │ ├── runtime-util.ts │ ├── slate-plugin.ts │ ├── vue-editor.ts │ ├── vue-hooks.ts │ ├── vue-runtime.ts │ └── with-vue.ts │ ├── tsconfig.json │ └── types.ts ├── renovate.json ├── ship.config.js ├── site ├── app.vue ├── index.css ├── main.js ├── pages │ ├── check-lists │ │ ├── checkListItem.vue │ │ ├── index.vue │ │ ├── render.js │ │ └── util.js │ ├── components │ │ ├── blockButton.vue │ │ ├── button.vue │ │ ├── icon.vue │ │ ├── markButton.vue │ │ ├── menu.vue │ │ └── toolbar.vue │ ├── editable-voids │ │ ├── editableVoidElement.vue │ │ ├── index.vue │ │ ├── insertEditableVoidButton.vue │ │ └── render.js │ ├── embeds │ │ ├── UrlInput.vue │ │ ├── index.vue │ │ ├── render.js │ │ ├── util.js │ │ └── videoElement.vue │ ├── forced-layout │ │ ├── index.vue │ │ ├── render.js │ │ └── util.js │ ├── hovering-toolbar │ │ ├── formatButton.vue │ │ ├── hoveringToolbar.vue │ │ ├── index.vue │ │ ├── render.js │ │ └── util.js │ ├── hugeDocument │ │ ├── index.vue │ │ └── render.js │ ├── images │ │ ├── imageElement.vue │ │ ├── index.vue │ │ ├── insertImageButton.vue │ │ └── render.js │ ├── links │ │ ├── index.vue │ │ ├── linkButton.vue │ │ └── render.js │ ├── markdown-preview │ │ ├── index.vue │ │ └── render.js │ ├── markdown-shortcuts │ │ ├── index.vue │ │ └── render.js │ ├── mentions │ │ ├── index.vue │ │ ├── mentions.vue │ │ ├── render.js │ │ └── utils.js │ ├── paste-html │ │ ├── index.vue │ │ └── render.js │ ├── plaintext │ │ └── index.vue │ ├── readonly │ │ └── index.vue │ ├── richtext │ │ ├── index.vue │ │ └── render.js │ ├── search-highlighting │ │ ├── index.vue │ │ └── render.js │ └── table │ │ ├── index.vue │ │ └── render.js ├── public │ └── index.html └── router │ └── index.js ├── tsconfig.json └── yarn.lock /.github/workflows/shipjs-manual-prepare.yml: -------------------------------------------------------------------------------- 1 | name: Ship js Manual Prepare 2 | on: 3 | issue_comment: 4 | types: [created] 5 | jobs: 6 | manual_prepare: 7 | if: | 8 | github.event_name == 'issue_comment' && 9 | (github.event.comment.author_association == 'member' || github.event.comment.author_association == 'owner') && 10 | startsWith(github.event.comment.body, '@shipjs prepare') 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v2 14 | with: 15 | fetch-depth: 0 16 | ref: master 17 | - uses: actions/setup-node@v1 18 | - run: | 19 | if [ -f "yarn.lock" ]; then 20 | yarn install 21 | else 22 | npm install 23 | fi 24 | - run: | 25 | git config --global user.email "github-actions[bot]@users.noreply.github.com" 26 | git config --global user.name "github-actions[bot]" 27 | - run: npm run release -- --yes --no-browse 28 | env: 29 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 30 | SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }} 31 | 32 | create_done_comment: 33 | if: success() 34 | needs: manual_prepare 35 | runs-on: ubuntu-latest 36 | steps: 37 | - uses: actions/github@master 38 | env: 39 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 40 | with: 41 | args: comment "@${{ github.actor }} `shipjs prepare` done" 42 | 43 | create_fail_comment: 44 | if: cancelled() || failure() 45 | needs: manual_prepare 46 | runs-on: ubuntu-latest 47 | steps: 48 | - uses: actions/github@master 49 | env: 50 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 51 | with: 52 | args: comment "@${{ github.actor }} `shipjs prepare` fail" 53 | -------------------------------------------------------------------------------- /.github/workflows/shipjs-trigger.yml: -------------------------------------------------------------------------------- 1 | name: Ship js trigger 2 | on: 3 | pull_request: 4 | branches: [ master ] 5 | types: 6 | - closed 7 | jobs: 8 | build: 9 | name: Release 10 | runs-on: ubuntu-latest 11 | if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/v') 12 | steps: 13 | - uses: actions/checkout@v2 14 | with: 15 | fetch-depth: 0 16 | ref: master 17 | - uses: actions/setup-node@v1 18 | with: 19 | registry-url: "https://registry.npmjs.org" 20 | - run: yarn install 21 | - run: npx shipjs trigger 22 | env: 23 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 24 | NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} 25 | SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }} 26 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | on: 3 | push: 4 | branches: [ master ] 5 | pull_request: 6 | branches: [ master ] 7 | jobs: 8 | build: 9 | name: Test 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | with: 14 | fetch-depth: 0 15 | - uses: actions/setup-node@v1 16 | with: 17 | registry-url: "https://registry.npmjs.org" 18 | - run: yarn install 19 | - run: yarn test 20 | env: 21 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 22 | NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} 23 | SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }} 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # System and module 2 | .DS_Store 3 | node_modules/ 4 | /dist 5 | /packages/*/dist 6 | .cache 7 | 8 | # Log files 9 | npm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | 13 | # Editor directories and files 14 | .idea 15 | .vscode 16 | *.suo 17 | *.ntvs* 18 | *.njsproj 19 | *.sln 20 | *.sw* 21 | 22 | dist/ 23 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # [](https://github.com/marsprince/slate-vue/compare/v0.1.9...v) (2020-11-17) 2 | 3 | 4 | ### Bug Fixes 5 | 6 | * **component:** avoid getting in no cacheVnode ([d2e8963](https://github.com/marsprince/slate-vue/commit/d2e8963e649bf13efcbac6a67317c8d879d1c32e)), closes [#63](https://github.com/marsprince/slate-vue/issues/63) 7 | * **editable:** trigger beforeinput event in FireFox ([52af03a](https://github.com/marsprince/slate-vue/commit/52af03a2416472baca4f636b0cf6a9ffa0101b16)) 8 | 9 | 10 | ### Features 11 | 12 | * **plugin:** make setFragmentData pluginnable ([eb91a3d](https://github.com/marsprince/slate-vue/commit/eb91a3d916c15ead8ceb5692a0fefe39147e8faa)) 13 | 14 | 15 | 16 | # [](https://github.com/marsprince/slate-vue/compare/v0.1.8...v) (2020-11-10) 17 | 18 | 19 | 20 | # [](https://github.com/marsprince/slate-vue/compare/v0.1.7...v) (2020-11-10) 21 | 22 | 23 | ### Bug Fixes 24 | 25 | * **deps:** update dependency slate to ^0.59.0 ([#48](https://github.com/marsprince/slate-vue/issues/48)) ([34ba9c6](https://github.com/marsprince/slate-vue/commit/34ba9c66b256bceb20053ca3fbdea2016cee524e)) 26 | * **deps:** update dependency slate-history to ^0.59.0 ([#49](https://github.com/marsprince/slate-vue/issues/49)) ([5c5716b](https://github.com/marsprince/slate-vue/commit/5c5716bf65978bc20077ba3cda0dc443b96c9883)) 27 | * **deps:** update dependency slate-hyperscript to ^0.59.0 ([#50](https://github.com/marsprince/slate-vue/issues/50)) ([9be3f4b](https://github.com/marsprince/slate-vue/commit/9be3f4bc1fd3bd9ae020a7c94af0cd99897dafe8)) 28 | * **deps:** update dependency vue-tsx-support to v3 ([#57](https://github.com/marsprince/slate-vue/issues/57)) ([c57a81e](https://github.com/marsprince/slate-vue/commit/c57a81ef699c60bb8d7ee5ae37b97a550138ec49)) 29 | * **editable:** fixing selection ([d9fd600](https://github.com/marsprince/slate-vue/commit/d9fd6008d56fcb3a66801f0e559d641c5d79134b)), closes [#58](https://github.com/marsprince/slate-vue/issues/58) 30 | * **string:** fix functioncomponent props bug ([e5174d9](https://github.com/marsprince/slate-vue/commit/e5174d9ddfbc69eaf9a74872536e583edca6953d)) 31 | 32 | 33 | 34 | # [](https://github.com/marsprince/slate-vue/compare/v0.1.6...v) (2020-09-21) 35 | 36 | 37 | ### Features 38 | 39 | * **core:** support $editor.clear, bug fixs ([bf33790](https://github.com/marsprince/slate-vue/commit/bf33790e87a38a15669181ea2575809743d90d62)) 40 | 41 | 42 | 43 | # [](https://github.com/marsprince/slate-vue/compare/v0.1.5...v) (2020-09-17) 44 | 45 | 46 | ### Features 47 | 48 | * **core:** support this.value = '' ([2dc5b6e](https://github.com/marsprince/slate-vue/commit/2dc5b6e6bfbfae1b2a02f740701614dda45282c0)) 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 marsprince 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Slate-vue 2 | 3 | [![Build Status](https://img.shields.io/github/workflow/status/marsprince/slate-vue/Test)](https://github.com/marsprince/slate-vue/actions?query=workflow%3ATest) 4 | [![NPM Version](https://img.shields.io/npm/v/slate-vue?color=brightgreen)](https://www.npmjs.com/package/slate-vue) 5 | [![NPM Size](https://img.shields.io/badge/gzip-36kb-brightgreen)](https://unpkg.com/slate-vue/dist/index.es.js) 6 | 7 | An implement for [slate](https://github.com/ianstormtaylor/slate) supported vue2 and vue3(in development). Most of the slate-react's components can be easily migrated by no code change. 8 | 9 | All slate-react's example is supported now. 10 | 11 | For principles's question, Please read slate's [docs](https://docs.slatejs.org/) first! 12 | 13 | ## Install 14 | 15 | in npm 16 | 17 | ```javascript 18 | npm install slate-vue 19 | ``` 20 | 21 | in yarn 22 | 23 | ```javascript 24 | yarn add slate-vue 25 | ``` 26 | 27 | ## Usage 28 | 29 | import 30 | 31 | ```javascript 32 | import Vue from 'vue' 33 | import { SlatePlugin } from 'slate-vue'; 34 | Vue.use(SlatePlugin) 35 | ``` 36 | 37 | use 38 | 39 | ```vue 40 | 45 | 46 | 70 | ``` 71 | 72 | See full vue2.x document in [slate-vue](https://github.com/marsprince/slate-vue/tree/master/packages/slate-vue) 73 | 74 | ## Examples 75 | 76 | See all examples in [online example](https://marsprince.github.io/slate-vue). 77 | 78 | See all example code in [pages](https://github.com/marsprince/slate-vue/tree/master/site/pages) 79 | 80 | ## Issues 81 | 82 | You can use this [codesandbox template](https://codesandbox.io/s/2984l) to reproduce problems. 83 | 84 | ## Environment Support 85 | 86 | | [Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | 87 | | --- | --- | --- | --- | 88 | | testing | testing | 86.0+ | testing | 89 | 90 | ## License 91 | 92 | [MIT](LICENSE) © marsprince 93 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | const babelConfigure = require('@razors/build-babel') 2 | const config = babelConfigure({ lib: 'vue' }, { 3 | "presets": [ 4 | ["@vue/babel-preset-jsx", { 5 | "injectH": false 6 | }]] 7 | }) 8 | 9 | module.exports = config 10 | -------------------------------------------------------------------------------- /config/rollup/rollup.config.js: -------------------------------------------------------------------------------- 1 | const rollupConfigure = require('@razors/build-rollup') 2 | const SlateVue = require('../../packages/slate-vue/package.json') 3 | const SlateVueShared = require('../../packages/slate-vue-shared/package.json') 4 | 5 | const babelOptions = { 6 | presets: [ 7 | ["@vue/babel-preset-jsx", { 8 | "injectH": false 9 | }]], 10 | } 11 | 12 | export default [ 13 | rollupConfigure(SlateVue, { 14 | target: 'es', 15 | useTypescript: true, 16 | useVue: true 17 | }, { 18 | babel: babelOptions 19 | }), 20 | rollupConfigure(SlateVue, { 21 | target: 'cjs', 22 | useTypescript: true, 23 | useVue: true 24 | }, { 25 | babel: babelOptions 26 | }), 27 | rollupConfigure(SlateVueShared, { 28 | target: 'es', 29 | useTypescript: true 30 | }, { 31 | babel: babelOptions 32 | }), 33 | rollupConfigure(SlateVueShared, { 34 | target: 'cjs', 35 | useTypescript: true 36 | }, { 37 | babel: babelOptions 38 | }) 39 | ] 40 | -------------------------------------------------------------------------------- /config/webpack/site/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const VueLoaderPlugin = require('vue-loader/lib/plugin') 3 | const HTMLWebpackPlugin = require('html-webpack-plugin'); 4 | const site = path.join(__dirname, '../../../site'); 5 | 6 | module.exports = { 7 | entry: path.join(site, 'main.js'), 8 | module: { 9 | rules: [ 10 | { test: /\.js$/, use: 'babel-loader', exclude: /node_modules/}, 11 | { test: /\.vue$/, use: 'vue-loader' }, 12 | { test: /\.tsx$/, use: ['babel-loader','ts-loader']}, 13 | { test: /\.ts$/, use: ['babel-loader','ts-loader']}, 14 | { test: /\.css$/, use: ['style-loader', 'css-loader']}, 15 | { test: /\.less$/, use: ['style-loader', 'css-loader', 'less-loader']}, 16 | ] 17 | }, 18 | resolve:{ 19 | extensions:['.js','.ts','.tsx','.vue'] 20 | }, 21 | plugins: [ 22 | new VueLoaderPlugin(), 23 | new HTMLWebpackPlugin({ 24 | template: path.resolve(site, './public/index.html') 25 | }) 26 | ] 27 | }; 28 | -------------------------------------------------------------------------------- /config/webpack/site/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | const merge = require('webpack-merge').merge; 2 | const base = require('./webpack.base.conf') 3 | 4 | module.exports = merge(base ,{ 5 | mode: 'development', 6 | devServer: { 7 | open: true, 8 | contentBase: '../../../site/public', 9 | historyApiFallback: true, 10 | port: 3000 11 | } 12 | }) 13 | -------------------------------------------------------------------------------- /config/webpack/site/webpack.publish.conf.js: -------------------------------------------------------------------------------- 1 | const base = require('./webpack.base.conf') 2 | const merge = require('webpack-merge').merge; 3 | const path = require('path') 4 | 5 | module.exports = merge(base, { 6 | mode: 'production', 7 | output: { 8 | path: path.resolve('./', 'docs') 9 | } 10 | }) 11 | -------------------------------------------------------------------------------- /docs/152.js.LICENSE.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * Prism: Lightweight, robust, elegant syntax highlighting 3 | * 4 | * @license MIT 5 | * @author Lea Verou 6 | * @namespace 7 | * @public 8 | */ 9 | -------------------------------------------------------------------------------- /docs/check-lists.js: -------------------------------------------------------------------------------- 1 | (self.webpackChunkslate_vue_packages=self.webpackChunkslate_vue_packages||[]).push([[417],{84373:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(23645),c=n.n(r)()((function(e){return e[1]}));c.push([e.id,".checkListItem[data-v-ac07af16] {\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n.checkListItem + .checkListItem[data-v-ac07af16] {\n margin-top: 0;\n}\n.checkListItem__input[data-v-ac07af16] {\n margin-right: 0.75em;\n}\n.checkListItem__content[data-v-ac07af16] {\n flex: 1;\n}\n.checkListItem__content[data-v-ac07af16]:focus {\n outline: none;\n}\n",""]);const i=c},15417:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>O});var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("Slate",{attrs:{value:JSON.stringify(e.initialValue)}},[n("Editable",{attrs:{placeholder:"Get to work…",renderElement:e.renderElement,autoFocus:!0}})],1)};r._withStripped=!0;var c=n(28245),i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"checkListItem"},[n("span",{staticClass:"checkListItem__input",attrs:{contentEditable:"false"}},[n("input",{attrs:{type:"checkbox"},domProps:{checked:e.checked},on:{change:e.onChange}})]),e._v(" "),n("span",{staticClass:"checkListItem__content",style:[{opacity:e.checked?.666:1},{textDecoration:e.checked?"none":"line-through"}],attrs:{suppressContentEditableWarning:"",contentEditable:!e.readOnly}},[e._t("default")],2)])};i._withStripped=!0;const a={name:"checkListItem",props:{element:Object},mixins:[c.n8],computed:{checked:function(){return this.element.checked}},methods:{onChange:function(e){var t=this.$editor,n=this.element,r=c.bR.findPath(t,n);c.YR.setNodes(t,{checked:e.target.checked},{at:r})}}};var o=n(93379),s=n.n(o),l=n(84373);s()(l.Z,{insert:"head",singleton:!1}),l.Z.locals;var h=n(51900),u=(0,h.Z)(a,i,[],!1,null,"ac07af16",null);u.options.__file="site/pages/check-lists/checkListItem.vue";const d=u.exports;function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function f(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n{"use strict";n.d(t,{Z:()=>a});var r=n(23645),i=n.n(r)()((function(e){return e[1]}));i.push([e.id,".iframe[data-v-007d5531] {\n padding: 75% 0 0 0;\n position: relative;\n}\n.iframe__content[data-v-007d5531] {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n",""]);const a=i},85810:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>j});var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("Slate",{attrs:{value:JSON.stringify(e.initialValue)}},[n("Editable",{attrs:{placeholder:"Enter some plain text...",renderElement:e.renderElement}})],1)};r._withStripped=!0;var i=n(28245),a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("div",{attrs:{contenteditable:"false"}},[n("div",{staticClass:"iframe"},[n("iframe",{staticClass:"iframe__content",attrs:{src:e.element.url+"?title=0&byline=0&portrait=0",frameBorder:"0"}})]),e._v(" "),n("UrlInput",{attrs:{url:e.element.url},on:{"update:url":function(t){return e.$set(e.element,"url",t)},change:e.onChange}})],1),e._v(" "),e._t("default")],2)};a._withStripped=!0;var o=function(){var e=this,t=e.$createElement;return(e._self._c||t)("input",{directives:[{name:"model",rawName:"v-model",value:e.value,expression:"value"}],domProps:{value:e.value},on:{click:e.onClick,change:e.onChange,input:function(t){t.target.composing||(e.value=t.target.value)}}})};o._withStripped=!0;const l={name:"UrlInput",props:{url:String},data:function(){return{value:this.url}},methods:{onClick:function(e){e.stopPropagation()},onChange:function(){this.$emit("change",this.value)}}};var s=n(51900),u=(0,s.Z)(l,o,[],!1,null,"699a95eb",null);u.options.__file="site/pages/embeds/UrlInput.vue";const c=u.exports,d={name:"videoElement",props:{element:Object},components:{UrlInput:c},methods:{onChange:function(e){var t=this.$editor,n=this.element,r=i.bR.findPath(t,n);i.YR.setNodes(t,{url:e},{at:r})}}};var p=n(93379),m=n.n(p),v=n(55295);m()(v.Z,{insert:"head",singleton:!1}),v.Z.locals;var f=(0,s.Z)(d,a,[],!1,null,"007d5531",null);f.options.__file="site/pages/embeds/videoElement.vue";const h=f.exports;function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function g(e){for(var t=1;t{"use strict";r.r(t),r.d(t,{default:()=>b});var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("Slate",{attrs:{value:JSON.stringify(e.initialValue)}},[r("Editable",{attrs:{placeholder:"Enter some plain text...",renderElement:e.renderElement}})],1)};n._withStripped=!0;var a=r(28245),o=r(12878);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(n=(i=l.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==l.return||l.return()}finally{if(a)throw o}}return r}}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,c=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(c)throw o}}}}(o.NB.children(e,u));try{for(f.s();!(s=f.n()).done;){var p=i(s.value,2),d=p[0],y=p[1],h=0===y[0]?"title":"paragraph";d.type!==h&&a.YR.setNodes(e,{type:h},{at:y})}}catch(e){f.e(e)}finally{f.f()}}return t([c,u])}}};var h=(0,r(51900).Z)(y,n,[],!1,null,"11bb22c8",null);h.options.__file="site/pages/forced-layout/index.vue";const b=h.exports}}]); -------------------------------------------------------------------------------- /docs/hugeDocument.js: -------------------------------------------------------------------------------- 1 | (self.webpackChunkslate_vue_packages=self.webpackChunkslate_vue_packages||[]).push([[301],{11763:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>O});var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("Slate",{attrs:{value:JSON.stringify(e.initialValue)}},[r("Editable",{attrs:{placeholder:"Enter some plain text...",renderElement:e.renderElement}})],1)};n._withStripped=!0;var a=r(28245),i=r(85384),c=r.n(i);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;tTitle
-------------------------------------------------------------------------------- /docs/links.js: -------------------------------------------------------------------------------- 1 | (self.webpackChunkslate_vue_packages=self.webpackChunkslate_vue_packages||[]).push([[460],{63728:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(23645),o=n.n(r)()((function(t){return t[1]}));o.push([t.id,".button[data-v-2b41aaf4] {\n cursor: pointer;\n}\n",""]);const i=o},97590:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var r=n(23645),o=n.n(r)()((function(t){return t[1]}));o.push([t.id,".toolbar[data-v-39400657] {\n position: relative;\n padding: 1px 18px 17px;\n margin: 0 -20px;\n border-bottom: 2px solid #eee;\n margin-bottom: 20px;\n}\n",""]);const i=o},68079:t=>{t.exports=function(t){if("string"!=typeof t)return!1;var o=t.match(e);if(!o)return!1;var i=o[1];return!!i&&!(!n.test(i)&&!r.test(i))};var e=/^(?:\w+:)?\/\/(\S+)$/,n=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,r=/^[^\s\.]+\.\S{2,}$/},87554:(t,e,n)=>{"use strict";n.d(e,{Z:()=>c});var r=function(){var t=this,e=t.$createElement;return(t._self._c||e)("span",{staticClass:"button",style:{color:t.color},on:{mousedown:function(e){return t.$emit("mouseDown",e)}}},[t._t("default")],2)};r._withStripped=!0;const o={name:"s-button",props:{active:Boolean,reversed:Boolean},computed:{color:function(){return this.reversed?this.active?"white":"#aaa":this.active?"black":"#ccc"}}};var i=n(93379),a=n.n(i),s=n(63728);a()(s.Z,{insert:"head",singleton:!1}),s.Z.locals;var l=(0,n(51900).Z)(o,r,[],!1,null,"2b41aaf4",null);l.options.__file="site/pages/components/button.vue";const c=l.exports},50405:(t,e,n)=>{"use strict";n.d(e,{Z:()=>l});var r=function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{staticClass:"toolbar"},[t._t("default")],2)};r._withStripped=!0;var o=n(93379),i=n.n(o),a=n(97590);i()(a.Z,{insert:"head",singleton:!1}),a.Z.locals;var s=(0,n(51900).Z)({name:"toolbar"},r,[],!1,null,"39400657",null);s.options.__file="site/pages/components/toolbar.vue";const l=s.exports},98668:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>Z});var r=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("Slate",{attrs:{value:JSON.stringify(t.initialValue)}},[n("Toolbar",[n("LinkButton")],1),t._v(" "),n("Editable",{attrs:{placeholder:"Enter some plain text...",renderElement:t.renderElement}})],1)};r._withStripped=!0;var o=n(28245),i=n(12878);function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n 15 | * 16 | * Copyright (c) 2014-2017, Jon Schlinkert. 17 | * Released under the MIT License. 18 | */ 19 | 20 | /*! 21 | * isobject 22 | * 23 | * Copyright (c) 2014-2017, Jon Schlinkert. 24 | * Released under the MIT License. 25 | */ 26 | 27 | /*! ***************************************************************************** 28 | Copyright (c) Microsoft Corporation. All rights reserved. 29 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use 30 | this file except in compliance with the License. You may obtain a copy of the 31 | License at http://www.apache.org/licenses/LICENSE-2.0 32 | 33 | THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 34 | KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 35 | WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 36 | MERCHANTABLITY OR NON-INFRINGEMENT. 37 | 38 | See the Apache Version 2.0 License for specific language governing permissions 39 | and limitations under the License. 40 | ***************************************************************************** */ 41 | 42 | /*! https://mths.be/esrever v0.2.0 by @mathias */ 43 | -------------------------------------------------------------------------------- /docs/markdown-preview.js: -------------------------------------------------------------------------------- 1 | (self.webpackChunkslate_vue_packages=self.webpackChunkslate_vue_packages||[]).push([[178],{11757:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>w});var r=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("Slate",{attrs:{value:JSON.stringify(t.initialValue)}},[n("Editable",{attrs:{decorate:t.decorate,placeholder:"Enter some plain text...",renderLeaf:t.renderLeaf}})],1)};r._withStripped=!0;var a=n(15660),o=n.n(a),i=n(28245),l=n(12878),u=n(36568),c=n.n(u);function d(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function s(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n(?:[\t ]*>)*/m,alias:"punctuation"},code:[{pattern:/^(?: {4}|\t).+/m,alias:"keyword"},{pattern:/``.+?``|`[^`\n]+`/,alias:"keyword"}],title:[{pattern:/\w+.*(?:\r?\n|\r)(?:==+|--+)/,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#+.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])([\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:/(^|[^\\])(\*\*|__)(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/,lookbehind:!0,inside:{punctuation:/^\*\*|^__|\*\*$|__$/}},italic:{pattern:/(^|[^\\])([*_])(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/,lookbehind:!0,inside:{punctuation:/^[*_]|[*_]$/}},url:{pattern:/!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)| ?\[[^\]\n]*\])/,inside:{variable:{pattern:/(!?\[)[^\]]+(?=\]$)/,lookbehind:!0},string:{pattern:/"(?:\\.|[^"\\])*"(?=\)$)/}}}}),o().languages.markdown.bold.inside.url=o().util.clone(o().languages.markdown.url),o().languages.markdown.italic.inside.url=o().util.clone(o().languages.markdown.url),o().languages.markdown.bold.inside.italic=o().util.clone(o().languages.markdown.italic),o().languages.markdown.italic.inside.bold=o().util.clone(o().languages.markdown.bold);var m=[{children:[{text:"Slate is flexible enough to add **decorations** that can format text based on its content. For example, this editor has **Markdown** preview decorations on it, to make it _dead_ simple to make an editor with built-in Markdown previewing."}]},{children:[{text:"## Try it out!"}]},{children:[{text:"Try it out for yourself!"}]}];const h={name:"markdown-preview",components:{Slate:i.mH,Editable:i.CX},mixins:[i.fw],data:function(){return{initialValue:m,renderLeaf:p}},computed:{decorate:function(){return function(t){var e,n,r=(n=2,function(t){if(Array.isArray(t))return t}(e=t)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],r=!0,a=!1,o=void 0;try{for(var i,l=t[Symbol.iterator]();!(r=(i=l.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(t){a=!0,o=t}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return n}}(e,n)||g(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=r[0],i=r[1],u=[];if(!l.xv.isText(a))return u;var c,d=function t(e){return"string"==typeof e?e.length:"string"==typeof e.content?e.content.length:e.content.reduce((function(e,n){return e+t(n)}),0)},s=0,f=function(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=g(t))){n&&(t=n);var r=0,a=function(){};return{s:a,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return i=t.done,t},e:function(t){l=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}(o().tokenize(a.text,o().languages.markdown));try{for(f.s();!(c=f.n()).done;){var p,y=c.value,m=s+d(y);"string"!=typeof y&&u.push((b(p={},y.type,!0),b(p,"anchor",{path:i,offset:s}),b(p,"focus",{path:i,offset:m}),p)),s=m}}catch(t){f.e(t)}finally{f.f()}return u}}}};var v=(0,n(51900).Z)(h,r,[],!1,null,"1ea24f7c",null);v.options.__file="site/pages/markdown-preview/index.vue";const w=v.exports}}]); -------------------------------------------------------------------------------- /docs/markdown-shortcuts.js: -------------------------------------------------------------------------------- 1 | (self.webpackChunkslate_vue_packages=self.webpackChunkslate_vue_packages||[]).push([[306],{36568:e=>{"use strict";function t(){return(t=Object.assign||function(e){for(var t,r=1;r{"use strict";r.r(t),r.d(t,{default:()=>y});var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("Slate",{attrs:{value:JSON.stringify(e.initialValue)}},[r("Editable",{attrs:{placeholder:"Enter some plain text...",renderElement:e.renderElement}})],1)};n._withStripped=!0;var i=r(28245),a=r(36568),o=r.n(a),l=r(12878);function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,i=!1,a=void 0;try{for(var o,l=e[Symbol.iterator]();!(n=(o=l.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==l.return||l.return()}finally{if(i)throw a}}return r}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r":"block-quote","#":"heading-one","##":"heading-two","###":"heading-three","####":"heading-four","#####":"heading-five","######":"heading-six"},d=function(e){e.attributes;var t=e.children,r=e.element;return{render:function(){var e=arguments[0],n={attr:n};switch(r.type){case"block-quote":return e("blockquote",o()([{},n]),[t]);case"bulleted-list":return e("ul",o()([{},n]),[t]);case"heading-one":return e("h1",o()([{},n]),[t]);case"heading-two":return e("h2",o()([{},n]),[t]);case"heading-three":return e("h3",o()([{},n]),[t]);case"heading-four":return e("h4",o()([{},n]),[t]);case"heading-five":return e("h5",o()([{},n]),[t]);case"heading-six":return e("h6",o()([{},n]),[t]);case"list-item":return e("li",o()([{},n]),[t]);default:return e("p",o()([{},n]),[t])}}}},h=[{type:"paragraph",children:[{text:'The editor gives you full control over the logic you can add. For example, it\'s fairly common to want to add markdown-like shortcuts to editors. So that, when you start a line with "> " you get a blockquote that looks like this:'}]},{type:"block-quote",children:[{text:"A wise quote."}]},{type:"paragraph",children:[{text:'Order when you start a line with "## " you get a level-two heading, like this:'}]},{type:"heading-two",children:[{text:"Try it out!"}]},{type:"paragraph",children:[{text:'Try it out for yourself! Try starting a new line with ">", "-", or "#"s.'}]}];const f={name:"index",components:{Slate:i.mH,Editable:i.CX},data:function(){return{initialValue:h,renderElement:d}},created:function(){var e,t,r;e=this.$editor,t=e.deleteBackward,r=e.insertText,e.insertText=function(t){var n=e.selection;if(" "===t&&n&&l.e6.isCollapsed(n)){var a=n.anchor,o=l.ML.above(e,{match:function(t){return l.ML.isBlock(e,t)}}),s=o?o[1]:[],u={anchor:a,focus:l.ML.start(e,s)},d=l.ML.string(e,u),h=c[d];if(h)return i.YR.select(e,u),i.YR.delete(e),i.YR.setNodes(e,{type:h},{match:function(t){return l.ML.isBlock(e,t)}}),void("list-item"===h&&i.YR.wrapNodes(e,{type:"bulleted-list",children:[]},{match:function(e){return"list-item"===e.type}}))}r(t)},e.deleteBackward=function(){var r=e.selection;if(r&&l.e6.isCollapsed(r)){var n=l.ML.above(e,{match:function(t){return l.ML.isBlock(e,t)}});if(n){var a=s(n,2),o=a[0],u=a[1],c=l.ML.start(e,u);if("paragraph"!==o.type&&l.E9.equals(r.anchor,c))return i.YR.setNodes(e,{type:"paragraph"}),void("list-item"===o.type&&i.YR.unwrapNodes(e,{match:function(e){return"bulleted-list"===e.type},split:!0}))}t.apply(void 0,arguments)}}}};var p=(0,r(51900).Z)(f,n,[],!1,null,"b4f44932",null);p.options.__file="site/pages/markdown-shortcuts/index.vue";const y=p.exports}}]); -------------------------------------------------------------------------------- /docs/paste-html.js.LICENSE.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | * is-plain-object 3 | * 4 | * Copyright (c) 2014-2017, Jon Schlinkert. 5 | * Released under the MIT License. 6 | */ 7 | 8 | /*! 9 | * isobject 10 | * 11 | * Copyright (c) 2014-2017, Jon Schlinkert. 12 | * Released under the MIT License. 13 | */ 14 | -------------------------------------------------------------------------------- /docs/plaintext.js: -------------------------------------------------------------------------------- 1 | (self.webpackChunkslate_vue_packages=self.webpackChunkslate_vue_packages||[]).push([[746],{15416:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>c});var l=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("Slate",{attrs:{value:e.value}},[a("button",{on:{click:e.clear}},[e._v("clear")]),e._v(" "),a("Editable",{attrs:{placeholder:"Enter some plain text...",spellcheck:"true",autoCorrect:"on"}})],1)};l._withStripped=!0;var n=a(28245),r=[{children:[{text:"This is editable plain text, just like a