@yoopta/exports 1.9.14-rc → 1.9.15-rc
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/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { serializeHtml } from './html/serialize';
|
|
2
|
+
import { deserializeMarkdown } from './markdown/deserialize';
|
|
3
|
+
import { serializeMarkdown } from './markdown/serialize';
|
|
4
|
+
import { deserializeHtml } from './html/deserialize';
|
|
5
|
+
declare const markdown: {
|
|
6
|
+
deserialize: typeof deserializeMarkdown;
|
|
7
|
+
serialize: typeof serializeMarkdown;
|
|
8
|
+
};
|
|
9
|
+
declare const html: {
|
|
10
|
+
deserialize: typeof deserializeHtml;
|
|
11
|
+
serialize: typeof serializeHtml;
|
|
12
|
+
};
|
|
13
|
+
declare const yooptaExports: {
|
|
14
|
+
markdown: {
|
|
15
|
+
deserialize: typeof deserializeMarkdown;
|
|
16
|
+
serialize: typeof serializeMarkdown;
|
|
17
|
+
};
|
|
18
|
+
html: {
|
|
19
|
+
deserialize: typeof deserializeHtml;
|
|
20
|
+
serialize: typeof serializeHtml;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export { markdown, html };
|
|
24
|
+
export default yooptaExports;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{Text as t,Range as e,Node as r,createEditor as n,Element as o}from"slate";var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},a=200,s="__lodash_hash_undefined__",c="[object Function]",u="[object GeneratorFunction]",l=/^\[object .+?Constructor\]$/,f="object"==typeof i&&i&&i.Object===Object&&i,p="object"==typeof self&&self&&self.Object===Object&&self,h=f||p||Function("return this")();function d(t,e){return!!(t?t.length:0)&&function(t,e,r){if(e!=e)return function(t,e,r,n){var o=t.length,i=r+(n?1:-1);for(;n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}(t,y,r);var n=r-1,o=t.length;for(;++n<o;)if(t[n]===e)return n;return-1}(t,e,0)>-1}function v(t,e,r){for(var n=-1,o=t?t.length:0;++n<o;)if(r(e,t[n]))return!0;return!1}function y(t){return t!=t}function g(t,e){return t.has(e)}function b(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var m,_=Array.prototype,O=Function.prototype,w=Object.prototype,j=h["__core-js_shared__"],x=(m=/[^.]+$/.exec(j&&j.keys&&j.keys.IE_PROTO||""))?"Symbol(src)_1."+m:"",P=O.toString,E=w.hasOwnProperty,T=w.toString,S=RegExp("^"+P.call(E).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),z=_.splice,N=C(h,"Map"),D=C(h,"Set"),k=C(Object,"create");function F(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function R(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function $(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function A(t){var e=-1,r=t?t.length:0;for(this.__data__=new $;++e<r;)this.add(t[e])}function M(t,e){for(var r,n,o=t.length;o--;)if((r=t[o][0])===(n=e)||r!=r&&n!=n)return o;return-1}function B(t){if(!G(t)||(e=t,x&&x in e))return!1;var e,r=function(t){var e=G(t)?T.call(t):"";return e==c||e==u}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?S:l;return r.test(function(t){if(null!=t){try{return P.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}F.prototype.clear=function(){this.__data__=k?k(null):{}},F.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},F.prototype.get=function(t){var e=this.__data__;if(k){var r=e[t];return r===s?void 0:r}return E.call(e,t)?e[t]:void 0},F.prototype.has=function(t){var e=this.__data__;return k?void 0!==e[t]:E.call(e,t)},F.prototype.set=function(t,e){return this.__data__[t]=k&&void 0===e?s:e,this},R.prototype.clear=function(){this.__data__=[]},R.prototype.delete=function(t){var e=this.__data__,r=M(e,t);return!(r<0)&&(r==e.length-1?e.pop():z.call(e,r,1),!0)},R.prototype.get=function(t){var e=this.__data__,r=M(e,t);return r<0?void 0:e[r][1]},R.prototype.has=function(t){return M(this.__data__,t)>-1},R.prototype.set=function(t,e){var r=this.__data__,n=M(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},$.prototype.clear=function(){this.__data__={hash:new F,map:new(N||R),string:new F}},$.prototype.delete=function(t){return L(this,t).delete(t)},$.prototype.get=function(t){return L(this,t).get(t)},$.prototype.has=function(t){return L(this,t).has(t)},$.prototype.set=function(t,e){return L(this,t).set(t,e),this},A.prototype.add=A.prototype.push=function(t){return this.__data__.set(t,s),this},A.prototype.has=function(t){return this.__data__.has(t)};var I=D&&1/b(new D([,-0]))[1]==1/0?function(t){return new D(t)}:function(){};function L(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function C(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return B(r)?r:void 0}function G(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}var U=function(t,e){return t&&t.length?function(t,e,r){var n=-1,o=d,i=t.length,s=!0,c=[],u=c;if(r)s=!1,o=v;else if(i>=a){var l=e?null:I(t);if(l)return b(l);s=!1,o=g,u=new A}else u=e?[]:c;t:for(;++n<i;){var f=t[n],p=e?e(f):f;if(f=r||0!==f?f:0,s&&p==p){for(var h=u.length;h--;)if(u[h]===p)continue t;e&&u.push(p),c.push(f)}else o(u,p,r)||(u!==c&&u.push(p),c.push(f))}return c}(t,void 0,e):[]};function W(t){const e=t.map((t=>{const e=t.getPlugin,{childPlugin:r}=e,n=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(e,["childPlugin"]);return r?[n,Object.assign(Object.assign({},r.getPlugin),{hasParent:!0})]:n})).flat();return U(e,((t,e)=>t.type===e.type))}function q(t){const e=W(t),r={};return e.forEach((t=>r[t.type]=t)),r}function Y(t){const e=W(t),r={};return e.forEach((t=>{var e,n,o,i,a,s,c,u;if(null===(n=null===(e=t.exports)||void 0===e?void 0:e.html.deserialize)||void 0===n?void 0:n.nodeName){if(Array.isArray(null===(i=null===(o=t.exports)||void 0===o?void 0:o.html.deserialize)||void 0===i?void 0:i.nodeName))return void(null===(s=null===(a=t.exports)||void 0===a?void 0:a.html.deserialize)||void 0===s||s.nodeName.forEach((e=>{r[e]=t})));r[null===(u=null===(c=t.exports)||void 0===c?void 0:c.html.deserialize)||void 0===u?void 0:u.nodeName]=t}})),r}function H(e,r){var n,o;if(t.isText(e))return function(t){const e={"&":"&","<":"<",">":">",'"':""","'":"'"};return t.replace(/[&<>"']/g,(t=>e[t]))}(e.text);const i=e.children.map((t=>H(t,r))).join(""),a=r[e.type];return"function"==typeof(null===(o=null===(n=a.exports)||void 0===n?void 0:n.html)||void 0===o?void 0:o.serialize)?a.exports.html.serialize(e,i):i}
|
|
2
|
+
/*!
|
|
3
|
+
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
6
|
+
* Released under the MIT License.
|
|
7
|
+
*/
|
|
8
|
+
function J(t){return"[object Object]"===Object.prototype.toString.call(t)}function K(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Q=new WeakMap,V=new WeakMap;class X{}class Z extends X{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:e,path:r}=t;this.offset=e,this.path=r}}class tt extends X{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:e,path:r}=t;this.offset=e,this.path=r}}var et=t=>V.get(t);function rt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function nt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?rt(Object(r),!0).forEach((function(e){K(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):rt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var ot=new WeakSet,it=e=>{var r=[],n=e=>{if(null!=e){var i=r[r.length-1];if("string"==typeof e){var a={text:e};ot.add(a),e=a}if(t.isText(e)){var s=e;t.isText(i)&&ot.has(i)&&ot.has(s)&&t.equals(i,s,{loose:!0})?i.text+=s.text:r.push(s)}else if(o.isElement(e))r.push(e);else{if(!(e instanceof X))throw new Error("Unexpected hyperscript child object: ".concat(e));var c=r[r.length-1];t.isText(c)||(n(""),c=r[r.length-1]),e instanceof Z?((t,e)=>{var r=t.text.length;Q.set(t,[r,e])})(c,e):e instanceof tt&&((t,e)=>{var r=t.text.length;V.set(t,[r,e])})(c,e)}}};for(var i of e.flat(1/0))n(i);return r};function at(t,e,r){return nt(nt({},e),{},{children:it(r)})}function st(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ct(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?st(Object(r),!0).forEach((function(e){K(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):st(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var ut,lt={anchor:function(t,e,r){return new Z(e)},cursor:function(t,e,r){return[new Z(e),new tt(e)]},editor:(ut=n,(t,n,o)=>{var i,a=[];for(var s of o)e.isRange(s)?i=s:a.push(s);var c,u=it(a),l={},f=ut();for(var[p,h]of(Object.assign(f,n),f.children=u,r.texts(f))){var d=(c=p,Q.get(c)),v=et(p);if(null!=d){var[y]=d;l.anchor={path:h,offset:y}}if(null!=v){var[g]=v;l.focus={path:h,offset:g}}}if(l.anchor&&!l.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<anchor />`. For collapsed selections, use `<cursor />` instead.");if(!l.anchor&&l.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<focus />`. For collapsed selections, use `<cursor />` instead.");return null!=i?f.selection=i:e.isRange(l)&&(f.selection=l),f}),element:at,focus:function(t,e,r){return new tt(e)},fragment:function(t,e,r){return it(r)},selection:function(t,e,r){var n=r.find((t=>t instanceof Z)),o=r.find((t=>t instanceof tt));if(!n||null==n.offset||null==n.path)throw new Error("The <selection> hyperscript tag must have an <anchor> tag as a child with `path` and `offset` attributes defined.");if(!o||null==o.offset||null==o.path)throw new Error("The <selection> hyperscript tag must have a <focus> tag as a child with `path` and `offset` attributes defined.");return nt({anchor:{offset:n.offset,path:n.path},focus:{offset:o.offset,path:o.path}},e)},text:function(e,r,n){var o=it(n);if(o.length>1)throw new Error("The <text> hyperscript tag must only contain a single node's worth of children.");var[i]=o;if(null==i&&(i={text:""}),!t.isText(i))throw new Error("\n The <text> hyperscript tag can only contain text content as children.");return ot.delete(i),Object.assign(i,r),i}},ft=t=>function(e,r){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,s,c,u=t[e];if(!u)throw new Error("No hyperscript creator found for tag: <".concat(e,">"));return null==r&&(r={}),(!1===J(a=r)||void 0!==(s=a.constructor)&&(!1===J(c=s.prototype)||!1===c.hasOwnProperty("isPrototypeOf")))&&(o=[r].concat(o),r={}),u(e,r,o=o.filter((t=>Boolean(t))).flat())},pt=t=>{var e={},r=function(r){var n=t[r];if("object"!=typeof n)throw new Error("Properties specified for a hyperscript shorthand should be an object, but for the custom element <".concat(r,"> tag you passed: ").concat(n));e[r]=(t,e,r)=>at(0,ct(ct({},n),e),r)};for(var n in t)r(n);return e},ht=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{elements:e={}}=t,r=pt(e),n=ct(ct(ct({},lt),r),t.creators);return ft(n)}();const dt={DEL:()=>({strikethrough:!0}),EM:()=>({italic:!0}),I:()=>({italic:!0}),S:()=>({strikethrough:!0}),STRONG:()=>({bold:!0}),U:()=>({underline:!0})},vt=(e,r)=>{var n,o,i,a;if(3===e.nodeType)return e.textContent;if(1!==e.nodeType)return null;if("BR"===e.nodeName)return"\n";const{nodeName:s}=e;let c=e,u=Array.from(c.childNodes).map((t=>vt(t,r))).flat();if(0===u.length&&(u=[{text:""}]),"BODY"===e.nodeName)return ht("fragment",{},u);if(r[s]){const t=r[s];if(t){let r=t.defineElement();if("function"==typeof(null===(o=null===(n=t.exports)||void 0===n?void 0:n.html.deserialize)||void 0===o?void 0:o.parse)){const n=null===(a=null===(i=t.exports)||void 0===i?void 0:i.html.deserialize)||void 0===a?void 0:a.parse(e);r=Object.assign(Object.assign({},r),{data:n})}return ht("element",r,u)}}if(t.isTextList(u))return ht("element",r.P.defineElement(),u);if(dt[s]){const r=dt[s](e);return u.map((e=>t.isText(e)?ht("text",r,e):e))}return u};const yt=(e,r)=>{var n,o;if(t.isText(e))return e.text;const i=e.children.map((t=>yt(t,r))).join(""),a=null===(o=null===(n=r[e.type].exports)||void 0===n?void 0:n.markdown)||void 0===o?void 0:o.serialize;return"function"==typeof a?`${a(e,i)}\n`:`\n${i}\n`};const gt={DEL:()=>({strikethrough:!0}),EM:()=>({italic:!0}),I:()=>({italic:!0}),S:()=>({strikethrough:!0}),STRONG:()=>({bold:!0}),U:()=>({underline:!0})},bt=(e,r)=>{var n,o,i,a;if(3===e.nodeType)return e.textContent;if(1!==e.nodeType)return null;if("BR"===e.nodeName)return"\n";const{nodeName:s}=e;let c=e,u=Array.from(c.childNodes).map((t=>bt(t,r))).flat();if(0===u.length&&(u=[{text:""}]),"BODY"===e.nodeName)return ht("fragment",{},u);if(r[s]){const t=r[s];if(t){let r=t.defineElement();if("function"==typeof(null===(o=null===(n=t.exports)||void 0===n?void 0:n.html.deserialize)||void 0===o?void 0:o.parse)){const n=null===(a=null===(i=t.exports)||void 0===i?void 0:i.html.deserialize)||void 0===a?void 0:a.parse(e);r=Object.assign(Object.assign({},r),{data:n})}return ht("element",r,u)}}if(t.isTextList(u))return ht("element",r.P.defineElement(),u);if(gt[s]){const r=gt[s](e);return u.map((e=>t.isText(e)?ht("text",r,e):e))}return u};const mt={deserialize:function(t,e){const r=Y(e),n=(new DOMParser).parseFromString(t,"text/html");return vt(n.body,r)},serialize:function(t,e){const r=q(e);return t.map((t=>yt(t,r))).join("")}},_t={deserialize:function(t,e){const r=Y(e),n=(new DOMParser).parseFromString(t,"text/html");return bt(n.body,r)},serialize:function(t,e){const r=q(e);return t.map((t=>H(t,r))).join("")}},Ot={markdown:mt,html:_t};export{Ot as default,_t as html,mt as markdown};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { YooptaBaseElement, YooptaPluginType } from '@yoopta/editor';
|
|
2
|
+
export declare function mergePlugins(plugins: any): YooptaPluginType[];
|
|
3
|
+
export declare function mergePluginTypesToMap(plugins: YooptaPluginType<unknown, YooptaBaseElement<string>>[]): Record<YooptaBaseElement<string>['type'], YooptaPluginType<any, YooptaBaseElement<string>>>;
|
|
4
|
+
export declare function mergePluginTypesToMapHMTLNodeName(plugins: YooptaPluginType<unknown, YooptaBaseElement<string>>[]): Record<YooptaBaseElement<string>['type'], YooptaPluginType<any, YooptaBaseElement<string>>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/exports",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.15-rc",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Darginec05 <devopsbanda@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/Darginec05/Editor-Yoopta#readme",
|
|
@@ -36,4 +36,4 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"lodash.uniqwith": "^4.5.0"
|
|
38
38
|
}
|
|
39
|
-
}
|
|
39
|
+
}
|