@react-fabric/lexical 1.0.0-beta.9 → 1.0.1
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/{src/editor/Lexical.module.css → css/_lexical.css} +79 -13
- package/css/styles.css +24 -0
- package/dist/cjs/{packages/lexical/src/editor → editor}/LexicalEditor.js +98 -45
- package/dist/cjs/{packages/lexical/src/hooks → hooks}/useFormatWatcher.js +147 -140
- package/dist/cjs/i18n/ar/lexical.json.js +30 -0
- package/dist/cjs/i18n/en/lexical.json.js +30 -0
- package/{src/plugins/StickyPlugin.ts → dist/cjs/i18n/index.js} +10 -15
- package/dist/cjs/index.js +36 -0
- package/dist/cjs/plugins/CommentPlugin.js +481 -0
- package/dist/cjs/{packages/lexical/src/plugins → plugins}/DraggableBlockPlugin.js +17 -20
- package/dist/cjs/{packages/lexical/src/plugins → plugins}/ToolbarPlugin.js +58 -37
- package/dist/esm/{packages/lexical/src/editor → editor}/LexicalEditor.js +101 -48
- package/dist/esm/{packages/lexical/src/hooks → hooks}/useFormatWatcher.js +95 -88
- package/dist/esm/i18n/ar/lexical.json.js +25 -0
- package/dist/esm/i18n/en/lexical.json.js +25 -0
- package/dist/esm/i18n/index.js +33 -0
- package/dist/esm/index.js +34 -0
- package/dist/esm/plugins/CommentPlugin.js +481 -0
- package/dist/esm/{packages/lexical/src/plugins → plugins}/DraggableBlockPlugin.js +15 -18
- package/dist/esm/{packages/lexical/src/plugins → plugins}/ToolbarPlugin.js +59 -38
- package/dist/types/editor/LexicalEditor.d.ts +33 -4
- package/dist/types/hooks/useFormatWatcher.d.ts +7 -4
- package/dist/types/i18n/index.d.ts +1 -0
- package/dist/types/index.d.ts +27 -0
- package/dist/types/plugins/CommentPlugin.d.ts +5 -0
- package/dist/types/plugins/DraggableBlockPlugin.d.ts +3 -2
- package/dist/types/plugins/ToolbarPlugin.d.ts +1 -1
- package/dist/types/utils/index.d.ts +3 -6
- package/package.json +18 -18
- package/src/editor/LexicalEditor.tsx +95 -55
- package/src/hooks/useFormatWatcher.ts +50 -74
- package/src/i18n/ar/lexical.json +18 -0
- package/src/i18n/en/lexical.json +18 -0
- package/src/i18n/index.ts +28 -0
- package/src/index.ts +24 -17
- package/src/plugins/CommentPlugin.tsx +523 -0
- package/src/plugins/DraggableBlockPlugin.tsx +23 -68
- package/src/plugins/ToolbarPlugin.tsx +83 -131
- package/src/utils/index.ts +12 -108
- package/dist/cjs/_virtual/prism.js +0 -5
- package/dist/cjs/editor/Lexical.module.css +0 -1
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +0 -432
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.js +0 -21
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -27
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.dev.js +0 -1139
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.js +0 -25
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.prod.js +0 -50
- package/dist/cjs/node_modules/@lexical/html/LexicalHtml.dev.js +0 -245
- package/dist/cjs/node_modules/@lexical/html/LexicalHtml.js +0 -19
- package/dist/cjs/node_modules/@lexical/html/LexicalHtml.prod.js +0 -18
- package/dist/cjs/node_modules/@lexical/link/LexicalLink.dev.js +0 -471
- package/dist/cjs/node_modules/@lexical/link/LexicalLink.js +0 -17
- package/dist/cjs/node_modules/@lexical/link/LexicalLink.prod.js +0 -24
- package/dist/cjs/node_modules/@lexical/list/LexicalList.dev.js +0 -1275
- package/dist/cjs/node_modules/@lexical/list/LexicalList.js +0 -29
- package/dist/cjs/node_modules/@lexical/list/LexicalList.prod.js +0 -29
- package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.dev.js +0 -789
- package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.js +0 -29
- package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -26
- package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.dev.js +0 -976
- package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.js +0 -35
- package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -35
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.dev.js +0 -2792
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.js +0 -23
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.prod.js +0 -55
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.dev.js +0 -888
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.js +0 -35
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -66
- package/dist/cjs/node_modules/@mdi/js/mdi.js +0 -8
- package/dist/cjs/node_modules/prismjs/components/prism-c.js +0 -82
- package/dist/cjs/node_modules/prismjs/components/prism-clike.js +0 -33
- package/dist/cjs/node_modules/prismjs/components/prism-cpp.js +0 -101
- package/dist/cjs/node_modules/prismjs/components/prism-css.js +0 -66
- package/dist/cjs/node_modules/prismjs/components/prism-java.js +0 -126
- package/dist/cjs/node_modules/prismjs/components/prism-javascript.js +0 -174
- package/dist/cjs/node_modules/prismjs/components/prism-markdown.js +0 -417
- package/dist/cjs/node_modules/prismjs/components/prism-markup.js +0 -188
- package/dist/cjs/node_modules/prismjs/components/prism-objectivec.js +0 -14
- package/dist/cjs/node_modules/prismjs/components/prism-powershell.js +0 -60
- package/dist/cjs/node_modules/prismjs/components/prism-python.js +0 -67
- package/dist/cjs/node_modules/prismjs/components/prism-rust.js +0 -130
- package/dist/cjs/node_modules/prismjs/components/prism-sql.js +0 -34
- package/dist/cjs/node_modules/prismjs/components/prism-swift.js +0 -150
- package/dist/cjs/node_modules/prismjs/components/prism-typescript.js +0 -62
- package/dist/cjs/node_modules/prismjs/prism.js +0 -1951
- package/dist/cjs/packages/lexical/src/components/StickyComponent.js +0 -221
- package/dist/cjs/packages/lexical/src/index.js +0 -7
- package/dist/cjs/packages/lexical/src/nodes/StickyNode.js +0 -218
- package/dist/cjs/packages/lexical/src/plugins/StickyPlugin.js +0 -20
- package/dist/esm/_virtual/prism.js +0 -5
- package/dist/esm/editor/Lexical.module.css +0 -1
- package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +0 -423
- package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.js +0 -19
- package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -18
- package/dist/esm/node_modules/@lexical/code/LexicalCode.dev.js +0 -1121
- package/dist/esm/node_modules/@lexical/code/LexicalCode.js +0 -21
- package/dist/esm/node_modules/@lexical/code/LexicalCode.prod.js +0 -32
- package/dist/esm/node_modules/@lexical/html/LexicalHtml.dev.js +0 -244
- package/dist/esm/node_modules/@lexical/html/LexicalHtml.js +0 -18
- package/dist/esm/node_modules/@lexical/html/LexicalHtml.prod.js +0 -17
- package/dist/esm/node_modules/@lexical/link/LexicalLink.dev.js +0 -463
- package/dist/esm/node_modules/@lexical/link/LexicalLink.js +0 -17
- package/dist/esm/node_modules/@lexical/link/LexicalLink.prod.js +0 -16
- package/dist/esm/node_modules/@lexical/list/LexicalList.dev.js +0 -1262
- package/dist/esm/node_modules/@lexical/list/LexicalList.js +0 -23
- package/dist/esm/node_modules/@lexical/list/LexicalList.prod.js +0 -16
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.dev.js +0 -781
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.js +0 -23
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -18
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.dev.js +0 -957
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.js +0 -26
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -16
- package/dist/esm/node_modules/@lexical/table/LexicalTable.dev.js +0 -2754
- package/dist/esm/node_modules/@lexical/table/LexicalTable.js +0 -20
- package/dist/esm/node_modules/@lexical/table/LexicalTable.prod.js +0 -17
- package/dist/esm/node_modules/@lexical/utils/LexicalUtils.dev.js +0 -839
- package/dist/esm/node_modules/@lexical/utils/LexicalUtils.js +0 -26
- package/dist/esm/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -17
- package/dist/esm/node_modules/@mdi/js/mdi.js +0 -7
- package/dist/esm/node_modules/prismjs/components/prism-c.js +0 -82
- package/dist/esm/node_modules/prismjs/components/prism-clike.js +0 -33
- package/dist/esm/node_modules/prismjs/components/prism-cpp.js +0 -101
- package/dist/esm/node_modules/prismjs/components/prism-css.js +0 -66
- package/dist/esm/node_modules/prismjs/components/prism-java.js +0 -126
- package/dist/esm/node_modules/prismjs/components/prism-javascript.js +0 -174
- package/dist/esm/node_modules/prismjs/components/prism-markdown.js +0 -417
- package/dist/esm/node_modules/prismjs/components/prism-markup.js +0 -188
- package/dist/esm/node_modules/prismjs/components/prism-objectivec.js +0 -14
- package/dist/esm/node_modules/prismjs/components/prism-powershell.js +0 -60
- package/dist/esm/node_modules/prismjs/components/prism-python.js +0 -67
- package/dist/esm/node_modules/prismjs/components/prism-rust.js +0 -130
- package/dist/esm/node_modules/prismjs/components/prism-sql.js +0 -34
- package/dist/esm/node_modules/prismjs/components/prism-swift.js +0 -150
- package/dist/esm/node_modules/prismjs/components/prism-typescript.js +0 -62
- package/dist/esm/node_modules/prismjs/prism.js +0 -1951
- package/dist/esm/packages/lexical/src/components/StickyComponent.js +0 -221
- package/dist/esm/packages/lexical/src/index.js +0 -3
- package/dist/esm/packages/lexical/src/nodes/StickyNode.js +0 -216
- package/dist/esm/packages/lexical/src/plugins/StickyPlugin.js +0 -20
- package/dist/types/components/StickyComponent.d.ts +0 -9
- package/dist/types/nodes/StickyNode.d.ts +0 -35
- package/dist/types/plugins/StickyPlugin.d.ts +0 -1
- package/src/components/StickyComponent.tsx +0 -271
- package/src/nodes/StickyNode.tsx +0 -249
- /package/dist/cjs/{packages/lexical/src/editor → editor}/theme.js +0 -0
- /package/dist/cjs/{packages/lexical/src/utils → utils}/index.js +0 -0
- /package/dist/esm/{packages/lexical/src/editor → editor}/theme.js +0 -0
- /package/dist/esm/{packages/lexical/src/utils → utils}/index.js +0 -0
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var LexicalUtils_dev = require('./LexicalUtils.dev.js');
|
|
4
|
-
var LexicalUtils_prod = require('./LexicalUtils.prod.js');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the MIT license found in the
|
|
10
|
-
* LICENSE file in the root directory of this source tree.
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
const mod = process.env.NODE_ENV === 'development' ? LexicalUtils_dev : LexicalUtils_prod;
|
|
15
|
-
const $findMatchingParent = mod.$findMatchingParent;
|
|
16
|
-
const $getNearestBlockElementAncestorOrThrow = mod.$getNearestBlockElementAncestorOrThrow;
|
|
17
|
-
const $getNearestNodeOfType = mod.$getNearestNodeOfType;
|
|
18
|
-
const addClassNamesToElement = mod.addClassNamesToElement;
|
|
19
|
-
const isBlockDomNode = mod.isBlockDomNode;
|
|
20
|
-
const isHTMLAnchorElement = mod.isHTMLAnchorElement;
|
|
21
|
-
const isHTMLElement = mod.isHTMLElement;
|
|
22
|
-
const mergeRegister = mod.mergeRegister;
|
|
23
|
-
const objectKlassEquals = mod.objectKlassEquals;
|
|
24
|
-
const removeClassNamesFromElement = mod.removeClassNamesFromElement;
|
|
25
|
-
|
|
26
|
-
exports.$findMatchingParent = $findMatchingParent;
|
|
27
|
-
exports.$getNearestBlockElementAncestorOrThrow = $getNearestBlockElementAncestorOrThrow;
|
|
28
|
-
exports.$getNearestNodeOfType = $getNearestNodeOfType;
|
|
29
|
-
exports.addClassNamesToElement = addClassNamesToElement;
|
|
30
|
-
exports.isBlockDomNode = isBlockDomNode;
|
|
31
|
-
exports.isHTMLAnchorElement = isHTMLAnchorElement;
|
|
32
|
-
exports.isHTMLElement = isHTMLElement;
|
|
33
|
-
exports.mergeRegister = mergeRegister;
|
|
34
|
-
exports.objectKlassEquals = objectKlassEquals;
|
|
35
|
-
exports.removeClassNamesFromElement = removeClassNamesFromElement;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var lexical = require('lexical');
|
|
4
|
-
var LexicalSelection = require('../selection/LexicalSelection.js');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the MIT license found in the
|
|
10
|
-
* LICENSE file in the root directory of this source tree.
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
function g(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var p=g((function(e){const t=new URLSearchParams;t.append("code",e);for(let e=1;e<arguments.length;e++)t.append("v",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));const h="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,m=h&&"documentMode"in document?document.documentMode:null,v=h&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),y=h&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),w=!(!h||!("InputEvent"in window)||m)&&"getTargetRanges"in new window.InputEvent("input"),E=h&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),P=h&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,S=h&&/Android/.test(navigator.userAgent),x=h&&/^(?=.*Chrome).*/i.test(navigator.userAgent),N=h&&S&&x,A=h&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!x;function L(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}function b(...e){return ()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0;}}function T(e){return `${e}px`}const M={attributes:!0,characterData:!0,childList:!0,subtree:!0};function C(e,t,n){let o=null,r=null,l=null,i=[];const s=document.createElement("div");function u(){null===o&&p(182),null===r&&p(183);const{left:l,top:u}=o.getBoundingClientRect(),c=r,f=LexicalSelection.createRectsFromDOMRange(e,t);s.isConnected||c.append(s);let a=!1;for(let e=0;e<f.length;e++){const t=f[e],n=i[e]||document.createElement("div"),o=n.style;"absolute"!==o.position&&(o.position="absolute",a=!0);const r=T(t.left-l);o.left!==r&&(o.left=r,a=!0);const c=T(t.top-u);o.top!==c&&(n.style.top=c,a=!0);const d=T(t.width);o.width!==d&&(n.style.width=d,a=!0);const g=T(t.height);o.height!==g&&(n.style.height=g,a=!0),n.parentNode!==s&&(s.append(n),a=!0),i[e]=n;}for(;i.length>f.length;)i.pop();a&&n(i);}function c(){r=null,o=null,null!==l&&l.disconnect(),l=null,s.remove();for(const e of i)e.remove();i=[];}const f=e.registerRootListener((function t(){const n=e.getRootElement();if(null===n)return c();const i=n.parentElement;if(!(i instanceof HTMLElement))return c();c(),o=n,r=i,l=new MutationObserver((n=>{const l=e.getRootElement(),i=l&&l.parentElement;if(l!==o||i!==r)return t();for(const e of n)if(!s.contains(e.target))return u()})),l.observe(i,M),u();}));return ()=>{f(),c();}}function B(o,r){let l=null,i=null,s=null,u=null,c=()=>{};function f(f){f.read((()=>{const f=lexical.$getSelection();if(!lexical.$isRangeSelection(f))return l=null,i=null,s=null,u=null,c(),void(c=()=>{});const{anchor:a,focus:d}=f,g=a.getNode(),h=g.getKey(),m=a.offset,v=d.getNode(),y=v.getKey(),w=d.offset,E=o.getElementByKey(h),P=o.getElementByKey(y),S=null===l||null===E||m!==i||h!==l.getKey()||g!==l&&(!(l instanceof lexical.TextNode)||g.updateDOM(l,E,o._config)),x=null===s||null===P||w!==u||y!==s.getKey()||v!==s&&(!(s instanceof lexical.TextNode)||v.updateDOM(s,P,o._config));if(S||x){const e=o.getElementByKey(a.getNode().getKey()),t=o.getElementByKey(d.getNode().getKey());if(null!==e&&null!==t&&"SPAN"===e.tagName&&"SPAN"===t.tagName){const n=document.createRange();let l,i,s,u;d.isBefore(a)?(l=t,i=d.offset,s=e,u=a.offset):(l=e,i=a.offset,s=t,u=d.offset);const f=l.firstChild;null===f&&p(181);const g=s.firstChild;null===g&&p(181),n.setStart(f,i),n.setEnd(g,u),c(),c=C(o,n,(e=>{for(const t of e){const e=t.style;"Highlight"!==e.background&&(e.background="Highlight"),"HighlightText"!==e.color&&(e.color="HighlightText"),"-1"!==e.zIndex&&(e.zIndex="-1"),"none"!==e.pointerEvents&&(e.pointerEvents="none"),e.marginTop!==T(-1.5)&&(e.marginTop=T(-1.5)),e.paddingTop!==T(4)&&(e.paddingTop=T(4)),e.paddingBottom!==T(0)&&(e.paddingBottom=T(0));}void 0!==r&&r(e);}));}}l=g,i=m,s=v,u=w;}));}return f(o.getEditorState()),b(o.registerUpdateListener((({editorState:e})=>f(e))),c,(()=>{c();}))}const _=w,K=h,O=S,R=N,I=v,D=A,H=x,z=y,k=P,F=E;function $(e,...t){const n=L(...t);n.length>0&&e.classList.add(...n);}function U(e,...t){const n=L(...t);n.length>0&&e.classList.remove(...n);}function W(e,t){for(const n of t)if(e.type.startsWith(n))return !0;return !1}function j(e,t){const n=e[Symbol.iterator]();return new Promise(((e,o)=>{const r=[],l=()=>{const{done:i,value:s}=n.next();if(i)return e(r);const u=new FileReader;u.addEventListener("error",o),u.addEventListener("load",(()=>{const e=u.result;"string"==typeof e&&r.push({file:s,result:e}),l();})),W(s,t)?u.readAsDataURL(s):l();};l();}))}function V(e,t){const n=[],l=(e||lexical.$getRoot()).getLatest(),i=t||lexical.$isElementNode(l)&&l.getLastDescendant()||l;let s=l,u=function(e){let t=e,n=0;for(;null!==(t=t.getParent());)n++;return n}(s);for(;null!==s&&!s.is(i);)if(n.push({depth:u,node:s}),lexical.$isElementNode(s)&&s.getChildrenSize()>0)s=s.getFirstChild(),u++;else {let e=null;for(;null===e&&null!==s;)e=s.getNextSibling(),null===e?(s=s.getParent(),u--):s=e;}return null!==s&&s.is(i)&&n.push({depth:u,node:s}),n}function q(e){let t=e;if(lexical.$isElementNode(t)&&t.getChildrenSize()>0)t=t.getLastChild();else {let e=null;for(;null===e&&null!==t;)e=t.getPreviousSibling(),t=null===e?t.getParent():e;}return t}function G(e,t){let n=e;for(;null!=n;){if(n instanceof t)return n;n=n.getParent();}return null}function J(e){const t=Q(e,(e=>lexical.$isElementNode(e)&&!e.isInline()));return lexical.$isElementNode(t)||p(4,e.__key),t}const Q=(e,t)=>{let n=e;for(;n!==lexical.$getRoot()&&null!=n;){if(t(n))return n;n=n.getParent();}return null};function X(e,t,n,o){const r=e=>e instanceof t;return e.registerNodeTransform(t,(e=>{const t=(e=>{const t=e.getChildren();for(let e=0;e<t.length;e++){const n=t[e];if(r(n))return null}let n=e,o=e;for(;null!==n;)if(o=n,n=n.getParent(),r(n))return {child:o,parent:n};return null})(e);if(null!==t){const{child:r,parent:l}=t;if(r.is(e)){o(l,e);const t=r.getNextSiblings(),i=t.length;if(l.insertAfter(r),0!==i){const e=n(l);r.insertAfter(e);for(let n=0;n<i;n++)e.append(t[n]);}l.canBeEmpty()||0!==l.getChildrenSize()||l.remove();}}}))}function Y(e,t){const n=new Map,o=e._pendingEditorState;for(const[e,o]of t._nodeMap)n.set(e,lexical.$cloneWithProperties(o));o&&(o._nodeMap=n),e._dirtyType=2;const r=t._selection;lexical.$setSelection(null===r?null:r.clone());}function Z(n){const r=lexical.$getSelection()||lexical.$getPreviousSelection();if(lexical.$isRangeSelection(r)){const{focus:e}=r,t=e.getNode(),o=e.offset;if(lexical.$isRootOrShadowRoot(t)){const e=t.getChildAtIndex(o);null==e?t.append(n):e.insertBefore(n),n.selectNext();}else {let e,r;lexical.$isTextNode(t)?(e=t.getParentOrThrow(),r=t.getIndexWithinParent(),o>0&&(r+=1,t.splitText(o))):(e=t,r=o);const[,l]=lexical.$splitNode(e,r);l.insertBefore(n),l.selectStart();}}else {if(null!=r){const e=r.getNodes();e[e.length-1].getTopLevelElementOrThrow().insertAfter(n);}else {lexical.$getRoot().append(n);}const e=lexical.$createParagraphNode();n.insertAfter(e),e.select();}return n.getLatest()}function ee(e,t){const n=t();return e.replace(n),n.append(e),n}function te(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}function ne(e,t){const n=[];for(let o=0;o<e.length;o++){const r=t(e[o]);null!==r&&n.push(r);}return n}function oe(e,t){const n=e.getFirstChild();null!==n?n.insertBefore(t):e.append(t);}function re(e){if(z)return 1;let t=1;for(;e;)t*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return t}function le(e){return null!==e._parentEditor}
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(exports, "$splitNode", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () { return lexical.$splitNode; }
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(exports, "isBlockDomNode", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () { return lexical.isBlockDomNode; }
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "isHTMLAnchorElement", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () { return lexical.isHTMLAnchorElement; }
|
|
27
|
-
});
|
|
28
|
-
Object.defineProperty(exports, "isHTMLElement", {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
get: function () { return lexical.isHTMLElement; }
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(exports, "isInlineDomNode", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () { return lexical.isInlineDomNode; }
|
|
35
|
-
});
|
|
36
|
-
exports.$dfs = V;
|
|
37
|
-
exports.$filter = ne;
|
|
38
|
-
exports.$findMatchingParent = Q;
|
|
39
|
-
exports.$getNearestBlockElementAncestorOrThrow = J;
|
|
40
|
-
exports.$getNearestNodeOfType = G;
|
|
41
|
-
exports.$getNextRightPreorderNode = q;
|
|
42
|
-
exports.$insertFirst = oe;
|
|
43
|
-
exports.$insertNodeToNearestRoot = Z;
|
|
44
|
-
exports.$isEditorIsNestedEditor = le;
|
|
45
|
-
exports.$restoreEditorState = Y;
|
|
46
|
-
exports.$wrapNodeInElement = ee;
|
|
47
|
-
exports.CAN_USE_BEFORE_INPUT = _;
|
|
48
|
-
exports.CAN_USE_DOM = K;
|
|
49
|
-
exports.IS_ANDROID = O;
|
|
50
|
-
exports.IS_ANDROID_CHROME = R;
|
|
51
|
-
exports.IS_APPLE = I;
|
|
52
|
-
exports.IS_APPLE_WEBKIT = D;
|
|
53
|
-
exports.IS_CHROME = H;
|
|
54
|
-
exports.IS_FIREFOX = z;
|
|
55
|
-
exports.IS_IOS = k;
|
|
56
|
-
exports.IS_SAFARI = F;
|
|
57
|
-
exports.addClassNamesToElement = $;
|
|
58
|
-
exports.calculateZoomLevel = re;
|
|
59
|
-
exports.isMimeType = W;
|
|
60
|
-
exports.markSelection = B;
|
|
61
|
-
exports.mediaFileReader = j;
|
|
62
|
-
exports.mergeRegister = b;
|
|
63
|
-
exports.objectKlassEquals = te;
|
|
64
|
-
exports.positionNodeOnRange = C;
|
|
65
|
-
exports.registerNestedElementResolver = X;
|
|
66
|
-
exports.removeClassNamesFromElement = U;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// Material Design Icons v7.4.47
|
|
4
|
-
var mdiClose = "M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z";
|
|
5
|
-
var mdiFormatColorFill = "M19,11.5C19,11.5 17,13.67 17,15A2,2 0 0,0 19,17A2,2 0 0,0 21,15C21,13.67 19,11.5 19,11.5M5.21,10L10,5.21L14.79,10M16.56,8.94L7.62,0L6.21,1.41L8.59,3.79L3.44,8.94C2.85,9.5 2.85,10.47 3.44,11.06L8.94,16.56C9.23,16.85 9.62,17 10,17C10.38,17 10.77,16.85 11.06,16.56L16.56,11.06C17.15,10.47 17.15,9.5 16.56,8.94Z";
|
|
6
|
-
|
|
7
|
-
exports.mdiClose = mdiClose;
|
|
8
|
-
exports.mdiFormatColorFill = mdiFormatColorFill;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Prism.languages.c = Prism.languages.extend('clike', {
|
|
4
|
-
'comment': {
|
|
5
|
-
pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
|
|
6
|
-
greedy: true
|
|
7
|
-
},
|
|
8
|
-
'string': {
|
|
9
|
-
// https://en.cppreference.com/w/c/language/string_literal
|
|
10
|
-
pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
|
|
11
|
-
greedy: true
|
|
12
|
-
},
|
|
13
|
-
'class-name': {
|
|
14
|
-
pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
|
|
15
|
-
lookbehind: true
|
|
16
|
-
},
|
|
17
|
-
'keyword': /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,
|
|
18
|
-
'function': /\b[a-z_]\w*(?=\s*\()/i,
|
|
19
|
-
'number': /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
|
|
20
|
-
'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
Prism.languages.insertBefore('c', 'string', {
|
|
24
|
-
'char': {
|
|
25
|
-
// https://en.cppreference.com/w/c/language/character_constant
|
|
26
|
-
pattern: /'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,
|
|
27
|
-
greedy: true
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
Prism.languages.insertBefore('c', 'string', {
|
|
32
|
-
'macro': {
|
|
33
|
-
// allow for multiline macro definitions
|
|
34
|
-
// spaces after the # character compile fine with gcc
|
|
35
|
-
pattern: /(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
|
|
36
|
-
lookbehind: true,
|
|
37
|
-
greedy: true,
|
|
38
|
-
alias: 'property',
|
|
39
|
-
inside: {
|
|
40
|
-
'string': [
|
|
41
|
-
{
|
|
42
|
-
// highlight the path of the include statement as a string
|
|
43
|
-
pattern: /^(#\s*include\s*)<[^>]+>/,
|
|
44
|
-
lookbehind: true
|
|
45
|
-
},
|
|
46
|
-
Prism.languages.c['string']
|
|
47
|
-
],
|
|
48
|
-
'char': Prism.languages.c['char'],
|
|
49
|
-
'comment': Prism.languages.c['comment'],
|
|
50
|
-
'macro-name': [
|
|
51
|
-
{
|
|
52
|
-
pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
|
|
53
|
-
lookbehind: true
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
|
|
57
|
-
lookbehind: true,
|
|
58
|
-
alias: 'function'
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
// highlight macro directives as keywords
|
|
62
|
-
'directive': {
|
|
63
|
-
pattern: /^(#\s*)[a-z]+/,
|
|
64
|
-
lookbehind: true,
|
|
65
|
-
alias: 'keyword'
|
|
66
|
-
},
|
|
67
|
-
'directive-hash': /^#/,
|
|
68
|
-
'punctuation': /##|\\(?=[\r\n])/,
|
|
69
|
-
'expression': {
|
|
70
|
-
pattern: /\S[\s\S]*/,
|
|
71
|
-
inside: Prism.languages.c
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
Prism.languages.insertBefore('c', 'function', {
|
|
78
|
-
// highlight predefined macros as constants
|
|
79
|
-
'constant': /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
delete Prism.languages.c['boolean'];
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Prism.languages.clike = {
|
|
4
|
-
'comment': [
|
|
5
|
-
{
|
|
6
|
-
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
|
|
7
|
-
lookbehind: true,
|
|
8
|
-
greedy: true
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
pattern: /(^|[^\\:])\/\/.*/,
|
|
12
|
-
lookbehind: true,
|
|
13
|
-
greedy: true
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
'string': {
|
|
17
|
-
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
|
|
18
|
-
greedy: true
|
|
19
|
-
},
|
|
20
|
-
'class-name': {
|
|
21
|
-
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
|
|
22
|
-
lookbehind: true,
|
|
23
|
-
inside: {
|
|
24
|
-
'punctuation': /[.\\]/
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
|
|
28
|
-
'boolean': /\b(?:false|true)\b/,
|
|
29
|
-
'function': /\b\w+(?=\()/,
|
|
30
|
-
'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
|
|
31
|
-
'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
|
|
32
|
-
'punctuation': /[{}[\];(),.:]/
|
|
33
|
-
};
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
(function (Prism) {
|
|
4
|
-
|
|
5
|
-
var keyword = /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/;
|
|
6
|
-
var modName = /\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g, function () { return keyword.source; });
|
|
7
|
-
|
|
8
|
-
Prism.languages.cpp = Prism.languages.extend('c', {
|
|
9
|
-
'class-name': [
|
|
10
|
-
{
|
|
11
|
-
pattern: RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source
|
|
12
|
-
.replace(/<keyword>/g, function () { return keyword.source; })),
|
|
13
|
-
lookbehind: true
|
|
14
|
-
},
|
|
15
|
-
// This is intended to capture the class name of method implementations like:
|
|
16
|
-
// void foo::bar() const {}
|
|
17
|
-
// However! The `foo` in the above example could also be a namespace, so we only capture the class name if
|
|
18
|
-
// it starts with an uppercase letter. This approximation should give decent results.
|
|
19
|
-
/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,
|
|
20
|
-
// This will capture the class name before destructors like:
|
|
21
|
-
// Foo::~Foo() {}
|
|
22
|
-
/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,
|
|
23
|
-
// This also intends to capture the class name of method implementations but here the class has template
|
|
24
|
-
// parameters, so it can't be a namespace (until C++ adds generic namespaces).
|
|
25
|
-
/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/
|
|
26
|
-
],
|
|
27
|
-
'keyword': keyword,
|
|
28
|
-
'number': {
|
|
29
|
-
pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,
|
|
30
|
-
greedy: true
|
|
31
|
-
},
|
|
32
|
-
'operator': />>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,
|
|
33
|
-
'boolean': /\b(?:false|true)\b/
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
Prism.languages.insertBefore('cpp', 'string', {
|
|
37
|
-
'module': {
|
|
38
|
-
// https://en.cppreference.com/w/cpp/language/modules
|
|
39
|
-
pattern: RegExp(
|
|
40
|
-
/(\b(?:import|module)\s+)/.source +
|
|
41
|
-
'(?:' +
|
|
42
|
-
// header-name
|
|
43
|
-
/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source +
|
|
44
|
-
'|' +
|
|
45
|
-
// module name or partition or both
|
|
46
|
-
/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g, function () { return modName; }) +
|
|
47
|
-
')'
|
|
48
|
-
),
|
|
49
|
-
lookbehind: true,
|
|
50
|
-
greedy: true,
|
|
51
|
-
inside: {
|
|
52
|
-
'string': /^[<"][\s\S]+/,
|
|
53
|
-
'operator': /:/,
|
|
54
|
-
'punctuation': /\./
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
'raw-string': {
|
|
58
|
-
pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
|
|
59
|
-
alias: 'string',
|
|
60
|
-
greedy: true
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
Prism.languages.insertBefore('cpp', 'keyword', {
|
|
65
|
-
'generic-function': {
|
|
66
|
-
pattern: /\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,
|
|
67
|
-
inside: {
|
|
68
|
-
'function': /^\w+/,
|
|
69
|
-
'generic': {
|
|
70
|
-
pattern: /<[\s\S]+/,
|
|
71
|
-
alias: 'class-name',
|
|
72
|
-
inside: Prism.languages.cpp
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
Prism.languages.insertBefore('cpp', 'operator', {
|
|
79
|
-
'double-colon': {
|
|
80
|
-
pattern: /::/,
|
|
81
|
-
alias: 'punctuation'
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
Prism.languages.insertBefore('cpp', 'class-name', {
|
|
86
|
-
// the base clause is an optional list of parent classes
|
|
87
|
-
// https://en.cppreference.com/w/cpp/language/class
|
|
88
|
-
'base-clause': {
|
|
89
|
-
pattern: /(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,
|
|
90
|
-
lookbehind: true,
|
|
91
|
-
greedy: true,
|
|
92
|
-
inside: Prism.languages.extend('cpp', {})
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
Prism.languages.insertBefore('inside', 'double-colon', {
|
|
97
|
-
// All untokenized words that are not namespaces should be class names
|
|
98
|
-
'class-name': /\b[a-z_]\w*\b(?!\s*::)/i
|
|
99
|
-
}, Prism.languages.cpp['base-clause']);
|
|
100
|
-
|
|
101
|
-
}(Prism));
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
(function (Prism) {
|
|
4
|
-
|
|
5
|
-
var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
6
|
-
|
|
7
|
-
Prism.languages.css = {
|
|
8
|
-
'comment': /\/\*[\s\S]*?\*\//,
|
|
9
|
-
'atrule': {
|
|
10
|
-
pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
|
|
11
|
-
inside: {
|
|
12
|
-
'rule': /^@[\w-]+/,
|
|
13
|
-
'selector-function-argument': {
|
|
14
|
-
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
|
15
|
-
lookbehind: true,
|
|
16
|
-
alias: 'selector'
|
|
17
|
-
},
|
|
18
|
-
'keyword': {
|
|
19
|
-
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
|
20
|
-
lookbehind: true
|
|
21
|
-
}
|
|
22
|
-
// See rest below
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
'url': {
|
|
26
|
-
// https://drafts.csswg.org/css-values-3/#urls
|
|
27
|
-
pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
|
|
28
|
-
greedy: true,
|
|
29
|
-
inside: {
|
|
30
|
-
'function': /^url/i,
|
|
31
|
-
'punctuation': /^\(|\)$/,
|
|
32
|
-
'string': {
|
|
33
|
-
pattern: RegExp('^' + string.source + '$'),
|
|
34
|
-
alias: 'url'
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
'selector': {
|
|
39
|
-
pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
|
|
40
|
-
lookbehind: true
|
|
41
|
-
},
|
|
42
|
-
'string': {
|
|
43
|
-
pattern: string,
|
|
44
|
-
greedy: true
|
|
45
|
-
},
|
|
46
|
-
'property': {
|
|
47
|
-
pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
|
48
|
-
lookbehind: true
|
|
49
|
-
},
|
|
50
|
-
'important': /!important\b/i,
|
|
51
|
-
'function': {
|
|
52
|
-
pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
|
53
|
-
lookbehind: true
|
|
54
|
-
},
|
|
55
|
-
'punctuation': /[(){};:,]/
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
|
|
59
|
-
|
|
60
|
-
var markup = Prism.languages.markup;
|
|
61
|
-
if (markup) {
|
|
62
|
-
markup.tag.addInlined('style', 'css');
|
|
63
|
-
markup.tag.addAttribute('style', 'css');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
}(Prism));
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
(function (Prism) {
|
|
4
|
-
|
|
5
|
-
var keywords = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/;
|
|
6
|
-
|
|
7
|
-
// full package (optional) + parent classes (optional)
|
|
8
|
-
var classNamePrefix = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;
|
|
9
|
-
|
|
10
|
-
// based on the java naming conventions
|
|
11
|
-
var className = {
|
|
12
|
-
pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
|
|
13
|
-
lookbehind: true,
|
|
14
|
-
inside: {
|
|
15
|
-
'namespace': {
|
|
16
|
-
pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
|
|
17
|
-
inside: {
|
|
18
|
-
'punctuation': /\./
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
'punctuation': /\./
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
Prism.languages.java = Prism.languages.extend('clike', {
|
|
26
|
-
'string': {
|
|
27
|
-
pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,
|
|
28
|
-
lookbehind: true,
|
|
29
|
-
greedy: true
|
|
30
|
-
},
|
|
31
|
-
'class-name': [
|
|
32
|
-
className,
|
|
33
|
-
{
|
|
34
|
-
// variables, parameters, and constructor references
|
|
35
|
-
// this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
|
|
36
|
-
pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),
|
|
37
|
-
lookbehind: true,
|
|
38
|
-
inside: className.inside
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
// class names based on keyword
|
|
42
|
-
// this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
|
|
43
|
-
pattern: RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source + classNamePrefix + /[A-Z]\w*\b/.source),
|
|
44
|
-
lookbehind: true,
|
|
45
|
-
inside: className.inside
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
'keyword': keywords,
|
|
49
|
-
'function': [
|
|
50
|
-
Prism.languages.clike.function,
|
|
51
|
-
{
|
|
52
|
-
pattern: /(::\s*)[a-z_]\w*/,
|
|
53
|
-
lookbehind: true
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
'number': /\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
|
|
57
|
-
'operator': {
|
|
58
|
-
pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
|
|
59
|
-
lookbehind: true
|
|
60
|
-
},
|
|
61
|
-
'constant': /\b[A-Z][A-Z_\d]+\b/
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
Prism.languages.insertBefore('java', 'string', {
|
|
65
|
-
'triple-quoted-string': {
|
|
66
|
-
// http://openjdk.java.net/jeps/355#Description
|
|
67
|
-
pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
|
|
68
|
-
greedy: true,
|
|
69
|
-
alias: 'string'
|
|
70
|
-
},
|
|
71
|
-
'char': {
|
|
72
|
-
pattern: /'(?:\\.|[^'\\\r\n]){1,6}'/,
|
|
73
|
-
greedy: true
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
Prism.languages.insertBefore('java', 'class-name', {
|
|
78
|
-
'annotation': {
|
|
79
|
-
pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
|
|
80
|
-
lookbehind: true,
|
|
81
|
-
alias: 'punctuation'
|
|
82
|
-
},
|
|
83
|
-
'generics': {
|
|
84
|
-
pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
|
|
85
|
-
inside: {
|
|
86
|
-
'class-name': className,
|
|
87
|
-
'keyword': keywords,
|
|
88
|
-
'punctuation': /[<>(),.:]/,
|
|
89
|
-
'operator': /[?&|]/
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
'import': [
|
|
93
|
-
{
|
|
94
|
-
pattern: RegExp(/(\bimport\s+)/.source + classNamePrefix + /(?:[A-Z]\w*|\*)(?=\s*;)/.source),
|
|
95
|
-
lookbehind: true,
|
|
96
|
-
inside: {
|
|
97
|
-
'namespace': className.inside.namespace,
|
|
98
|
-
'punctuation': /\./,
|
|
99
|
-
'operator': /\*/,
|
|
100
|
-
'class-name': /\w+/
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
pattern: RegExp(/(\bimport\s+static\s+)/.source + classNamePrefix + /(?:\w+|\*)(?=\s*;)/.source),
|
|
105
|
-
lookbehind: true,
|
|
106
|
-
alias: 'static',
|
|
107
|
-
inside: {
|
|
108
|
-
'namespace': className.inside.namespace,
|
|
109
|
-
'static': /\b\w+$/,
|
|
110
|
-
'punctuation': /\./,
|
|
111
|
-
'operator': /\*/,
|
|
112
|
-
'class-name': /\w+/
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
],
|
|
116
|
-
'namespace': {
|
|
117
|
-
pattern: RegExp(
|
|
118
|
-
/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/
|
|
119
|
-
.source.replace(/<keyword>/g, function () { return keywords.source; })),
|
|
120
|
-
lookbehind: true,
|
|
121
|
-
inside: {
|
|
122
|
-
'punctuation': /\./,
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}(Prism));
|