@yoopta/divider 4.7.1-rc.4 → 4.7.1-rc.6
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/LICENSE +21 -0
- package/dist/commands/index.d.ts +4 -6
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/package.json +2 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-present Akhmed Ibragimov
|
|
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.
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { YooEditor, YooptaBlockPath } from '@yoopta/editor';
|
|
2
|
-
import { DividerElement } from '../types';
|
|
3
|
-
type
|
|
4
|
-
text?: string;
|
|
5
|
-
};
|
|
6
|
-
type DividerInsertOptions = DividerElementOptions & {
|
|
2
|
+
import { DividerElement, DividerElementProps } from '../types';
|
|
3
|
+
type DividerInsertOptions = DividerElementProps & {
|
|
7
4
|
at?: YooptaBlockPath;
|
|
8
5
|
focus?: boolean;
|
|
9
6
|
};
|
|
10
7
|
export type DividerCommands = {
|
|
11
|
-
buildDividerElements: (editor: YooEditor, options?: Partial<
|
|
8
|
+
buildDividerElements: (editor: YooEditor, options?: Partial<DividerElementProps>) => DividerElement;
|
|
12
9
|
insertDivider: (editor: YooEditor, options?: Partial<DividerInsertOptions>) => void;
|
|
13
10
|
deleteDivider: (editor: YooEditor, blockId: string) => void;
|
|
11
|
+
updateDivider: (editor: YooEditor, blockId: string, props: Partial<DividerElementProps>) => void;
|
|
14
12
|
};
|
|
15
13
|
export declare const DividerCommands: DividerCommands;
|
|
16
14
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgD,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/D,KAAK,oBAAoB,GAAG,mBAAmB,GAAG;IAChD,EAAE,CAAC,EAAE,eAAe,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,oBAAoB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,cAAc,CAAC;IACpG,aAAa,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;IACpF,aAAa,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,aAAa,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;CAClG,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,eA0B7B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateId as e,Blocks as t,buildBlockData as i,Elements as o,UI as r,useYooptaEditor as n,useBlockData as d,YooptaPlugin as s}from"@yoopta/editor";import{jsxs as l,jsx as a}from"react/jsx-runtime";import*as c from"react";const p={buildDividerElements:(t,i={})=>({id:e(),type:"divider",children:[{text:
|
|
1
|
+
import{generateId as e,Blocks as t,buildBlockData as i,Elements as o,UI as r,useYooptaEditor as n,useBlockData as d,YooptaPlugin as s}from"@yoopta/editor";import{jsxs as l,jsx as a}from"react/jsx-runtime";import*as c from"react";const p={buildDividerElements:(t,i={})=>({id:e(),type:"divider",children:[{text:""}],props:{color:i.color||"#EFEFEE",theme:i.theme||"solid",nodeType:"void"}}),insertDivider:(e,o={})=>{const{at:r,focus:n}=o,d=p.buildDividerElements(e);t.insertBlock(e,i({value:[d],type:"Divider"}),{at:r,focus:n})},deleteDivider:(e,i)=>{t.deleteBlock(e,{blockId:i})},updateDivider:(e,t,i)=>{o.updateElement(e,t,{type:"divider",props:Object.assign({},i)})}},h=["solid","dashed","dotted","gradient"];function u(e,t){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(i[o[r]]=e[o[r]])}return i}var m;function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},v.apply(this,arguments)}"function"==typeof SuppressedError&&SuppressedError;var b,y=function(e){return c.createElement("svg",v({width:15,height:15,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),m||(m=c.createElement("path",{d:"M1.25 7.5a.5.5 0 0 1 .5-.5h11.5a.5.5 0 0 1 0 1H1.75a.5.5 0 0 1-.5-.5Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})))};function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},g.apply(this,arguments)}var f,w=function(e){return c.createElement("svg",g({width:15,height:15,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),b||(b=c.createElement("path",{d:"M3.625 7.5a1.125 1.125 0 1 1-2.25 0 1.125 1.125 0 0 1 2.25 0Zm5 0a1.125 1.125 0 1 1-2.25 0 1.125 1.125 0 0 1 2.25 0ZM12.5 8.625a1.125 1.125 0 1 0 0-2.25 1.125 1.125 0 0 0 0 2.25Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})))};function x(){return x=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},x.apply(this,arguments)}var O,k=function(e){return c.createElement("svg",x({width:15,height:15,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),f||(f=c.createElement("path",{d:"M0 7.5A.5.5 0 0 1 .5 7H3a.5.5 0 0 1 0 1H.5a.5.5 0 0 1-.5-.5Zm5.75 0a.5.5 0 0 1 .5-.5h2.5a.5.5 0 0 1 0 1h-2.5a.5.5 0 0 1-.5-.5ZM12 7a.5.5 0 0 0 0 1h2.5a.5.5 0 0 0 0-1H12Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})))};function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},E.apply(this,arguments)}var j=function(e){return c.createElement("svg",E({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"checkmark_svg__lucide checkmark_svg__lucide-check"},e),O||(O=c.createElement("path",{d:"M20 6 9 17l-5-5"})))};const{ExtendedBlockActions:N,BlockOptionsMenuGroup:C,BlockOptionsMenuItem:D,BlockOptionsSeparator:B}=r,S=({editor:e,block:t,props:i})=>{const r=i=>{o.updateElement(e,t.id,{type:"divider",props:{theme:i}})},n=e=>(null==i?void 0:i.theme)===e;return l(N,Object.assign({onClick:()=>e.setSelection([t.meta.order]),className:"yoopta-divider-options"},{children:[a(B,{}),l(C,{children:[a(D,{children:l("button",Object.assign({type:"button",className:"yoopta-block-options-button justify-between",onClick:()=>r("solid")},{children:[l("span",Object.assign({className:"flex"},{children:[a(y,{width:16,height:16,className:"w-4 h-4 mr-2"}),"Line"]})),n("solid")&&a(j,{width:16,height:16,color:"#000",className:"w-4 h-4"})]}))}),a(D,{children:l("button",Object.assign({type:"button",className:"yoopta-block-options-button justify-between",onClick:()=>r("dashed")},{children:[l("span",Object.assign({className:"flex"},{children:[a(k,{width:16,height:16,color:"tranparent",className:"w-4 h-4 mr-2"}),"Dashed"]})),n("dashed")&&a(j,{width:16,height:16,color:"#000",className:"w-4 h-4"})]}))}),a(D,{children:l("button",Object.assign({type:"button",className:"yoopta-block-options-button justify-between",onClick:()=>r("dotted")},{children:[l("span",Object.assign({className:"flex"},{children:[a(w,{width:16,height:16,className:"w-4 h-4 mr-2"}),"Dots"]})),n("dotted")&&a(j,{width:16,height:16,color:"#000",className:"w-4 h-4"})]}))}),a(D,{children:l("button",Object.assign({type:"button",className:"yoopta-block-options-button justify-between",onClick:()=>r("gradient")},{children:[l("span",Object.assign({className:"flex"},{children:[a(y,{width:14,height:16,className:"w-4 h-4 mr-2",color:(null==i?void 0:i.color)||"#EFEFEE"}),"Gradient"]})),n("gradient")&&a(j,{width:16,height:16,color:"#000",className:"w-4 h-4"})]}))})]})]}))},F=new s({type:"Divider",elements:{divider:{render:e=>{var t,i,{extendRender:o}=e,r=u(e,["extendRender"]);const s=r.HTMLAttributes||{},{className:c=""}=s,p=u(s,["className"]),h=n(),m=d(r.blockId);if(o)return o(r);const v=(null===(t=r.element.props)||void 0===t?void 0:t.color)||"#e5e7eb",b=(null===(i=r.element.props)||void 0===i?void 0:i.theme)||"solid";return l("div",Object.assign({onClick:e=>{h.setSelection([m.meta.order]),h.setBlockSelected([m.meta.order])}},p,{className:`${c} yoopta-divider`},r.attributes,{contentEditable:!1},{children:[!h.readOnly&&a(S,{block:m,editor:h,props:r.element.props}),(()=>{switch(b){case"dashed":return a("hr",{className:"yoopta-divider-dashed",style:{borderColor:v}});case"dotted":return l("div",Object.assign({className:"yoopta-divider-dotted"},{children:[a("div",{style:{backgroundColor:v}}),a("div",{style:{backgroundColor:v}}),a("div",{style:{backgroundColor:v}})]}));case"gradient":return a("div",{className:"yoopta-divider-gradient",style:{background:`linear-gradient(to right, transparent, ${v}, transparent)`}});default:return a("hr",{className:"yoopta-divider-solid",style:{borderColor:v}})}})(),r.children]}))},props:{nodeType:"void",theme:"solid",color:"#EFEFEE"}}},options:{display:{title:"Divider",description:"Divide your blocks"},shortcuts:["---","divider","line"]},parsers:{html:{deserialize:{nodeNames:["HR"],parse:t=>{const i=t.getAttribute("data-meta-theme")||"solid",o=t.getAttribute("data-meta-color")||"#EFEFEE";return{id:e(),type:"divider",props:{nodeType:"void",theme:i,color:o},children:[{text:""}]}}},serialize:(e,t,i)=>{const{theme:o="solid",color:r="#EFEFEE"}=e.props||{};return`<hr data-meta-theme="${o}" data-meta-color="${r}" style="background-color: #8383e0; height: 1.2px" />`}},markdown:{serialize:(e,t)=>"---\n"}},commands:p,events:{onKeyDown:function(e,t,{hotkeys:i,currentBlock:r}){return t=>{if(i.isCmdShiftD(t)){t.preventDefault();const i=o.getElement(e,r.id,{type:"divider"}),n=h[(h.indexOf(i.props.theme)+1)%h.length];o.updateElement(e,r.id,{type:"divider",props:{theme:n}})}}}}});!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===i&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}(".mr-2{margin-right:.5rem}.block{display:block}.flex{display:flex}.h-4{height:1rem}.w-4{width:1rem}.justify-between{justify-content:space-between}.yoopta-divider .yoopta-divider-options{color:#000;opacity:0;right:3px;top:3px;transition:opacity .15s ease-in-out}.yoopta-divider:hover .yoopta-divider-options{opacity:1}.yoopta-divider{align-items:center;color:#e5e7eb;display:flex;height:20px;justify-content:center;pointer-events:auto;width:100%}.yoopta-divider-line{border-bottom:2px solid;height:1px;visibility:visible;width:100%}.yoopta-divider-solid{border-bottom:2px solid;border-bottom-style:solid;height:1px;visibility:visible;width:100%}.yoopta-divider-dashed{border-bottom:2px solid;border-bottom-style:dashed;height:1px;visibility:visible;width:100%}.yoopta-divider-dotted{align-items:center;border-bottom:2px solid;border-bottom:none;display:flex;height:3px;justify-content:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;visibility:visible;width:100%}.yoopta-divider-dotted div{border-radius:50%;margin-right:10px;max-height:3px;max-width:3px;min-height:3px;min-width:3px}.yoopta-divider-dotted div:last-child{margin-right:0}.yoopta-divider-gradient{height:2px;width:100%}");export{p as DividerCommands,F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG7C,QAAA,MAAM,OAAO,0DAsDX,CAAC;AAEH,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/divider",
|
|
3
|
-
"version": "4.7.1-rc.
|
|
3
|
+
"version": "4.7.1-rc.6",
|
|
4
4
|
"description": "Divider plugin for Yoopta Editor",
|
|
5
5
|
"author": "Darginec05 <devopsbanda@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/Darginec05/Editor-Yoopta#readme",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"bugs": {
|
|
35
35
|
"url": "https://github.com/Darginec05/Editor-Yoopta/issues"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "352f23c5d2d9345c213633d79686c3764a043479"
|
|
38
38
|
}
|