Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2021-11-30 14:03:38 +0300
committerMax <max@nextcloud.com>2022-02-09 11:42:41 +0300
commitedfbb70f1578dad76ff869b9f2ca0f3c027232d2 (patch)
treea4458fed13123910d3ab7a5024e08edc33993f0c /js/highlight
parent3c9f8e7b2c1d7019e79e855014ade08f79e86f2d (diff)
upgrade: tiptap v2
Migrate the entire editor to tiptap v2. Some changes were introduces that go beyond just using the new tiptap API: *Collaboration* Port tiptap1 collaboration. We still want to use our session and sync mechanism. *Serialization* Add Markdown extension to handle serialization. Tiptap config extensions are not automatically added to the prosemirror schema anymore. The extension adds the `toMarkdown` config value to the prosemirror schema. With the new naming scheme tiptap nodes for a number of elements do not match the prosemirror names. Camelcase the marks and nodes from `defaultMarkdownSerializer` so they match the tiptap names. *Menubar* * Specify args for isActive function directly rather than setting a function. * Make use of the editor instance inside the MenuBar component. * Use the editor rather than slots for command, focused etc. * disable icons based on editor.can * Show menubar as long as submenus are open. When opening a submenu of the menubar keep track of the open menu even for the image and the remaining action menu. Also refocus the editor whenever a submenu is closed. *MenuBubble* Let tippy handle the positioning Tippy is really good at positioning the menu bubble. Remove all our workarounds and let it do its thing. In order for this to work the content of the MenuBubble actually needs to live inside the tippy-content. Tippy bases its calculations on the width of tippy-content. So if we have the content hanging in a separate div with absolute positioning tippy-content will be 0x0 px and not represent the actual width of the menu bubble. *Upgrade image node and ImageView.* Quite a bit of the syntax changed. We now need a wrapping `<node-view-wrapper>` element. Pretty good docs at https://tiptap.dev/guide/node-views/vue#render-a-vue-component We also need to handle the async action. It will run the action on it's own. So in `clickIcon()` we need to test if the action returned anything. Tiptap v1 had inline images. v2 keeps them outside of paragraphs by default. Configure Image node to use inline images as markdownit creates inline images right now. *Trailing Node* Tiptap v2 does not ship the trailing node extension anymore. Included the one from the demos and turned it from typescript into javascript. *Tests* In order to isolate some problems tests were added. The tests in Undeline.spec.js were green right from the beginning. They are not related to the fix and only helped isolate the problem. Also introduced a cypress test for Lists that tests the editor without rendering the page and logging in. It is very fast and fairly easy to write. *Refactorings* * Split marks into separate files. Signed-off-by: Max <max@nextcloud.com>
Diffstat (limited to 'js/highlight')
-rw-r--r--js/highlight/json.js4
-rw-r--r--js/highlight/json.js.map2
2 files changed, 3 insertions, 3 deletions
diff --git a/js/highlight/json.js b/js/highlight/json.js
index ec60d1cf6..bf19aa8e8 100644
--- a/js/highlight/json.js
+++ b/js/highlight/json.js
@@ -1,2 +1,2 @@
-(self.webpackChunktext=self.webpackChunktext||[]).push([["highlight/json"],{82026:n=>{n.exports=function(n){const e={literal:"true false null"},t=[n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE],i=[n.QUOTE_STRING_MODE,n.C_NUMBER_MODE],l={end:",",endsWithParent:!0,excludeEnd:!0,contains:i,keywords:e},a={begin:/\{/,end:/\}/,contains:[{className:"attr",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE],illegal:"\\n"},n.inherit(l,{begin:/:/})].concat(t),illegal:"\\S"},s={begin:"\\[",end:"\\]",contains:[n.inherit(l)],illegal:"\\S"};return i.push(a,s),t.forEach((function(n){i.push(n)})),{name:"JSON",contains:i,keywords:e,illegal:"\\S"}}}}]);
-//# sourceMappingURL=json.js.map?v=f9f5d2fccfb8094349c9 \ No newline at end of file
+(self.webpackChunktext=self.webpackChunktext||[]).push([["highlight/json"],{53271:n=>{n.exports=function(n){const e={literal:"true false null"},t=[n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE],i=[n.QUOTE_STRING_MODE,n.C_NUMBER_MODE],l={end:",",endsWithParent:!0,excludeEnd:!0,contains:i,keywords:e},a={begin:/\{/,end:/\}/,contains:[{className:"attr",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE],illegal:"\\n"},n.inherit(l,{begin:/:/})].concat(t),illegal:"\\S"},s={begin:"\\[",end:"\\]",contains:[n.inherit(l)],illegal:"\\S"};return i.push(a,s),t.forEach((function(n){i.push(n)})),{name:"JSON",contains:i,keywords:e,illegal:"\\S"}}}}]);
+//# sourceMappingURL=json.js.map?v=d4602e1a371f45adbb11 \ No newline at end of file
diff --git a/js/highlight/json.js.map b/js/highlight/json.js.map
index 55b64d530..188bedf44 100644
--- a/js/highlight/json.js.map
+++ b/js/highlight/json.js.map
@@ -1 +1 @@
-{"version":3,"file":"highlight/json.js?v=f9f5d2fccfb8094349c9","mappings":"sFA8DAA,EAAOC,QAtDP,SAAcC,GACZ,MAAMC,EAAW,CACfC,QAAS,mBAELC,EAAmB,CACvBH,EAAKI,oBACLJ,EAAKK,sBAEDC,EAAQ,CACZN,EAAKO,kBACLP,EAAKQ,eAEDC,EAAkB,CACtBC,IAAK,IACLC,gBAAgB,EAChBC,YAAY,EACZC,SAAUP,EACVQ,SAAUb,GAENc,EAAS,CACbC,MAAO,KACPN,IAAK,KACLG,SAAU,CACR,CACEI,UAAW,OACXD,MAAO,IACPN,IAAK,IACLG,SAAU,CAACb,EAAKkB,kBAChBC,QAAS,OAEXnB,EAAKoB,QAAQX,EAAiB,CAC5BO,MAAO,OAETK,OAAOlB,GACTgB,QAAS,OAELG,EAAQ,CACZN,MAAO,MACPN,IAAK,MACLG,SAAU,CAACb,EAAKoB,QAAQX,IACxBU,QAAS,OAMX,OAJAb,EAAMiB,KAAKR,EAAQO,GACnBnB,EAAiBqB,SAAQ,SAASC,GAChCnB,EAAMiB,KAAKE,MAEN,CACLC,KAAM,OACNb,SAAUP,EACVQ,SAAUb,EACVkB,QAAS","sources":["webpack:///text/node_modules/highlight.js/lib/languages/json.js"],"sourcesContent":["/*\nLanguage: JSON\nDescription: JSON (JavaScript Object Notation) is a lightweight data-interchange format.\nAuthor: Ivan Sagalaev <maniac@softwaremaniacs.org>\nWebsite: http://www.json.org\nCategory: common, protocols\n*/\n\nfunction json(hljs) {\n const LITERALS = {\n literal: 'true false null'\n };\n const ALLOWED_COMMENTS = [\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE\n ];\n const TYPES = [\n hljs.QUOTE_STRING_MODE,\n hljs.C_NUMBER_MODE\n ];\n const VALUE_CONTAINER = {\n end: ',',\n endsWithParent: true,\n excludeEnd: true,\n contains: TYPES,\n keywords: LITERALS\n };\n const OBJECT = {\n begin: /\\{/,\n end: /\\}/,\n contains: [\n {\n className: 'attr',\n begin: /\"/,\n end: /\"/,\n contains: [hljs.BACKSLASH_ESCAPE],\n illegal: '\\\\n'\n },\n hljs.inherit(VALUE_CONTAINER, {\n begin: /:/\n })\n ].concat(ALLOWED_COMMENTS),\n illegal: '\\\\S'\n };\n const ARRAY = {\n begin: '\\\\[',\n end: '\\\\]',\n contains: [hljs.inherit(VALUE_CONTAINER)], // inherit is a workaround for a bug that makes shared modes with endsWithParent compile only the ending of one of the parents\n illegal: '\\\\S'\n };\n TYPES.push(OBJECT, ARRAY);\n ALLOWED_COMMENTS.forEach(function(rule) {\n TYPES.push(rule);\n });\n return {\n name: 'JSON',\n contains: TYPES,\n keywords: LITERALS,\n illegal: '\\\\S'\n };\n}\n\nmodule.exports = json;\n"],"names":["module","exports","hljs","LITERALS","literal","ALLOWED_COMMENTS","C_LINE_COMMENT_MODE","C_BLOCK_COMMENT_MODE","TYPES","QUOTE_STRING_MODE","C_NUMBER_MODE","VALUE_CONTAINER","end","endsWithParent","excludeEnd","contains","keywords","OBJECT","begin","className","BACKSLASH_ESCAPE","illegal","inherit","concat","ARRAY","push","forEach","rule","name"],"sourceRoot":""} \ No newline at end of file
+{"version":3,"file":"highlight/json.js?v=d4602e1a371f45adbb11","mappings":"sFA8DAA,EAAOC,QAtDP,SAAcC,GACZ,MAAMC,EAAW,CACfC,QAAS,mBAELC,EAAmB,CACvBH,EAAKI,oBACLJ,EAAKK,sBAEDC,EAAQ,CACZN,EAAKO,kBACLP,EAAKQ,eAEDC,EAAkB,CACtBC,IAAK,IACLC,gBAAgB,EAChBC,YAAY,EACZC,SAAUP,EACVQ,SAAUb,GAENc,EAAS,CACbC,MAAO,KACPN,IAAK,KACLG,SAAU,CACR,CACEI,UAAW,OACXD,MAAO,IACPN,IAAK,IACLG,SAAU,CAACb,EAAKkB,kBAChBC,QAAS,OAEXnB,EAAKoB,QAAQX,EAAiB,CAC5BO,MAAO,OAETK,OAAOlB,GACTgB,QAAS,OAELG,EAAQ,CACZN,MAAO,MACPN,IAAK,MACLG,SAAU,CAACb,EAAKoB,QAAQX,IACxBU,QAAS,OAMX,OAJAb,EAAMiB,KAAKR,EAAQO,GACnBnB,EAAiBqB,SAAQ,SAASC,GAChCnB,EAAMiB,KAAKE,MAEN,CACLC,KAAM,OACNb,SAAUP,EACVQ,SAAUb,EACVkB,QAAS","sources":["webpack:///text/node_modules/highlight.js/lib/languages/json.js"],"sourcesContent":["/*\nLanguage: JSON\nDescription: JSON (JavaScript Object Notation) is a lightweight data-interchange format.\nAuthor: Ivan Sagalaev <maniac@softwaremaniacs.org>\nWebsite: http://www.json.org\nCategory: common, protocols\n*/\n\nfunction json(hljs) {\n const LITERALS = {\n literal: 'true false null'\n };\n const ALLOWED_COMMENTS = [\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE\n ];\n const TYPES = [\n hljs.QUOTE_STRING_MODE,\n hljs.C_NUMBER_MODE\n ];\n const VALUE_CONTAINER = {\n end: ',',\n endsWithParent: true,\n excludeEnd: true,\n contains: TYPES,\n keywords: LITERALS\n };\n const OBJECT = {\n begin: /\\{/,\n end: /\\}/,\n contains: [\n {\n className: 'attr',\n begin: /\"/,\n end: /\"/,\n contains: [hljs.BACKSLASH_ESCAPE],\n illegal: '\\\\n'\n },\n hljs.inherit(VALUE_CONTAINER, {\n begin: /:/\n })\n ].concat(ALLOWED_COMMENTS),\n illegal: '\\\\S'\n };\n const ARRAY = {\n begin: '\\\\[',\n end: '\\\\]',\n contains: [hljs.inherit(VALUE_CONTAINER)], // inherit is a workaround for a bug that makes shared modes with endsWithParent compile only the ending of one of the parents\n illegal: '\\\\S'\n };\n TYPES.push(OBJECT, ARRAY);\n ALLOWED_COMMENTS.forEach(function(rule) {\n TYPES.push(rule);\n });\n return {\n name: 'JSON',\n contains: TYPES,\n keywords: LITERALS,\n illegal: '\\\\S'\n };\n}\n\nmodule.exports = json;\n"],"names":["module","exports","hljs","LITERALS","literal","ALLOWED_COMMENTS","C_LINE_COMMENT_MODE","C_BLOCK_COMMENT_MODE","TYPES","QUOTE_STRING_MODE","C_NUMBER_MODE","VALUE_CONTAINER","end","endsWithParent","excludeEnd","contains","keywords","OBJECT","begin","className","BACKSLASH_ESCAPE","illegal","inherit","concat","ARRAY","push","forEach","rule","name"],"sourceRoot":""} \ No newline at end of file