netlify / netlify-cms Public
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code Widget + Markdown Widget Internal Overhaul #2828
Conversation
@@ -1,32 +0,0 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to .eslintrc.js
@@ -1,21 +1,12 @@ | |||
{ | |||
"processors": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CSS-in-JS is now supported out of the box.
'@babel/preset-react', | ||
'@babel/preset-env', | ||
[ | ||
'@emotion/babel-preset-css-prop', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to Emotion upgrade.
@@ -1,7 +1,7 @@ | |||
const workflowStatus = { draft: 'Drafts', review: 'In Review', ready: 'Ready' }; | |||
const editorStatus = { draft: 'Draft', review: 'In review', ready: 'Ready' }; | |||
const setting1 = { limit: 10, author: 'John Doe' }; | |||
const setting2 = { name: 'Andrew Wommack', description: 'A Gospel Teacher' }; | |||
const setting2 = { name: 'Jane Doe', description: 'description' }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep example code generic.
dev-test/config.yml
Outdated
fields: | ||
- label: 'Code' | ||
name: 'code' | ||
widget: 'code' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temporary for testing.
@@ -35,7 +35,7 @@ | |||
"lint:css": "stylelint --ignore-path .gitignore \"{packages/**/*.{css,js},website/**/*.css}\"", | |||
"lint:js": "eslint --color --ignore-path .gitignore \"{{packages,scripts,website}/**/,}*.js\"", | |||
"lint:format": "prettier \"{{packages,scripts,website}/**/,}*.{js,css}\" --list-different", | |||
"format": "run-s \"lint:css -- --fix --quiet\" \"lint:js -- --fix --quiet\" \"format:prettier -- --write\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stylelint chokes on nested template literals, dropping autofix of css for now (will still be linted).
], | ||
"nohoist": [ | ||
"husky", | ||
"run-node" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best practice stuff for Husky w/ Lerna, attempting to make it work with Git worktrees, no luck so far.
package.json
Outdated
"eslint-config-prettier": "^6.5.0", | ||
"eslint-plugin-babel": "^5.3.0", | ||
"lerna": "^3.15.0", | ||
"monaco-editor-webpack-plugin": "^1.7.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: remove this plugin
@@ -1,12 +0,0 @@ | |||
import { NetlifyCmsCore as CMS } from 'netlify-cms-core'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rolled into single extensions file.
@@ -1,4 +0,0 @@ | |||
import { NetlifyCmsCore as CMS } from 'netlify-cms-core'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rolled into single extensions file.
@@ -31,6 +31,7 @@ | |||
"gotrue-js": "^0.9.24", | |||
"gray-matter": "^4.0.2", | |||
"history": "^4.7.2", | |||
"immer": "^3.1.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just trying it out.
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import ImmutablePropTypes from 'react-immutable-proptypes'; | ||
import styled from '@emotion/styled'; | ||
import { jsx, css } from '@emotion/core'; | ||
import { css } from '@emotion/core'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a bunch of these (includes removal of the comment in the first line) - I removed the jsx pragma in favor of the emotion babel plugin.
Will provide commentary on the rest tomorrow. |
.replace(/\uFEFF<br>/g, ''); | ||
expect(actualDomString).toEqual(oneLineTrim(expectedDomString)); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify cypress test syntax for comparing markdown widget content comparisons
|
||
Cypress.Commands.add('setCursorAfter', { prevSubject: true }, (subject, query) => { | ||
cy.wrap(subject).setCursor(query); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functions above provide naive selection support for cypress, works for our immediate purposes
"stylelint": "^9.10.1", | ||
"stylelint-config-recommended": "^2.1.0", | ||
"stylelint-config-styled-components": "^0.1.1", | ||
"stylelint-processor-styled-components": "^1.5.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no longer necessary
@@ -364,6 +364,7 @@ class Editor extends React.Component { | |||
logoutUser, | |||
deployPreview, | |||
loadDeployPreview, | |||
draftKey, | |||
slug, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a unique id to serve as a key when a new draft is loaded - this allows us to reliably reset the entire Editor component when we're dealing with a different entry to avoid weird nested state issues.
labelError: ` | ||
background-color: ${colors.errorText}; | ||
color: ${colorsRaw.white}; | ||
`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to dedicated component.
type="scroll" | ||
title="Sync scrolling" | ||
/> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified editor toggles.
Multiple widgets registered with name "${widgetName}". Only the last widget registered with | ||
this name will be used. | ||
`); | ||
} | ||
if (!control) { | ||
throw Error(`Widget "${widgetName}" registered without \`controlComponent\`.`); | ||
} | ||
registry.widgets[widgetName] = { control, preview, globalStyles }; | ||
registry.widgets[widgetName] = { control, preview, globalStyles, allowMapValue, ...options }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Widgets can choose to allow their values to be maps (like object widget does), and also pass in configurable values the CMS doesn't know about.
return produce(Object.entries(registry.widgets), draft => { | ||
return draft.map(([key, value]) => ({ name: key, ...value })); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method for grabbing all widgets without passing the actual object. Took the opportunity to introduce immer as a portable immutability provider.
} | ||
} | ||
|
||
registry.editorComponents = registry.editorComponents.set(plugin.id, plugin); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introduces an experimental API for editor components that integrate deep with Slate for specific roles, starting with the code-block type. This approach allows any editor component to utilize the integration.
@@ -64,6 +68,7 @@ const entryDraftReducer = (state = Map(), action) => { | |||
state.set('fieldsMetaData', Map()); | |||
state.set('fieldsErrors', Map()); | |||
state.set('hasChanged', true); | |||
state.set('key', uuid()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unique keys allow top level reset of the editor when a new draft is introduced.
return 'Plugin'; | ||
}, | ||
}); | ||
/* eslint-enable */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this was being overhauled, took the opportunity to remove another Immutable.js dependency.
toPreview: bind(toPreview) || (!widget && (bind(toBlock) || (() => 'Plugin'))), | ||
fields: fromJS(fields), | ||
...remainingConfig, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createEditorComponent()
now accepts a plain config object returns a plain object. Changes to the API are backwards compatible. Most notably, a widget
property is now accepted, so widgets can more or less be the editor component.
@@ -0,0 +1 @@ | |||
[{"label":"AGS Script","identifiers":["ags","asc","ash"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-c++src"},{"label":"APL","identifiers":["apl","dyalog"],"codemirror_mode":"apl","codemirror_mime_type":"text/apl"},{"label":"ASN.1","identifiers":["asn"],"codemirror_mode":"asn.1","codemirror_mime_type":"text/x-ttcn-asn"},{"label":"ASP","identifiers":["asp","aspx","asax","ascx","ashx","asmx","axd"],"codemirror_mode":"htmlembedded","codemirror_mime_type":"application/x-aspx"},{"label":"Alpine Abuild","identifiers":["abuild","apkbuild"],"codemirror_mode":"shell","codemirror_mime_type":"text/x-sh"},{"label":"AngelScript","identifiers":["angelscript","as"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-c++src"},{"label":"Ant Build System","identifiers":[],"codemirror_mode":"xml","codemirror_mime_type":"application/xml"},{"label":"Apex","identifiers":["apex","cls"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-java"},{"label":"Asymptote","identifiers":["asymptote","asy"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-kotlin"},{"label":"BibTeX","identifiers":["bibtex","bib"],"codemirror_mode":"stex","codemirror_mime_type":"text/x-stex"},{"label":"Brainfuck","identifiers":["brainfuck","b","bf"],"codemirror_mode":"brainfuck","codemirror_mime_type":"text/x-brainfuck"},{"label":"C","identifiers":["c","cats","h","idc"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-csrc"},{"label":"C#","identifiers":["csharp","cs","cake","csx"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-csharp"},{"label":"C++","identifiers":["cpp","cc","cp","cxx","h","hh","hpp","hxx","inc","inl","ino","ipp","re","tcc","tpp"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-c++src"},{"label":"C2hs Haskell","identifiers":["chs"],"codemirror_mode":"haskell","codemirror_mime_type":"text/x-haskell"},{"label":"CMake","identifiers":["cmake"],"codemirror_mode":"cmake","codemirror_mime_type":"text/x-cmake"},{"label":"COBOL","identifiers":["cobol","cob","cbl","ccp","cpy"],"codemirror_mode":"cobol","codemirror_mime_type":"text/x-cobol"},{"label":"COLLADA","identifiers":["collada","dae"],"codemirror_mode":"xml","codemirror_mime_type":"text/xml"},{"label":"CSON","identifiers":["cson"],"codemirror_mode":"coffeescript","codemirror_mime_type":"text/x-coffeescript"},{"label":"CSS","identifiers":["css"],"codemirror_mode":"css","codemirror_mime_type":"text/css"},{"label":"Cabal Config","identifiers":["Cabal","cabal"],"codemirror_mode":"haskell","codemirror_mime_type":"text/x-haskell"},{"label":"ChucK","identifiers":["chuck","ck"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-java"},{"label":"Clojure","identifiers":["clojure","clj","boot","cljc","cljs","cljscm","cljx","hic"],"codemirror_mode":"clojure","codemirror_mime_type":"text/x-clojure"},{"label":"Closure Templates","identifiers":["soy"],"codemirror_mode":"soy","codemirror_mime_type":"text/x-soy"},{"label":"Cloud Firestore Security Rules","identifiers":[],"codemirror_mode":"css","codemirror_mime_type":"text/css"},{"label":"CoffeeScript","identifiers":["coffeescript","coffee","cake","cjsx","iced"],"codemirror_mode":"coffeescript","codemirror_mime_type":"text/x-coffeescript"},{"label":"Common Lisp","identifiers":["lisp","asd","cl","l","lsp","ny","podsl","sexp"],"codemirror_mode":"commonlisp","codemirror_mime_type":"text/x-common-lisp"},{"label":"Common Workflow Language","identifiers":["cwl"],"codemirror_mode":"yaml","codemirror_mime_type":"text/x-yaml"},{"label":"Component Pascal","identifiers":["delphi","objectpascal","cp","cps"],"codemirror_mode":"pascal","codemirror_mime_type":"text/x-pascal"},{"label":"Crystal","identifiers":["crystal","cr"],"codemirror_mode":"crystal","codemirror_mime_type":"text/x-crystal"},{"label":"Cuda","identifiers":["cuda","cu","cuh"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-c++src"},{"label":"Cycript","identifiers":["cycript","cy"],"codemirror_mode":"javascript","codemirror_mime_type":"text/javascript"},{"label":"Cython","identifiers":["cython","pyrex","pyx","pxd","pxi"],"codemirror_mode":"python","codemirror_mime_type":"text/x-cython"},{"label":"D","identifiers":["d","di"],"codemirror_mode":"d","codemirror_mime_type":"text/x-d"},{"label":"DTrace","identifiers":["dtrace","d"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-csrc"},{"label":"Dart","identifiers":["dart"],"codemirror_mode":"dart","codemirror_mime_type":"application/dart"},{"label":"Dhall","identifiers":["dhall"],"codemirror_mode":"haskell","codemirror_mime_type":"text/x-haskell"},{"label":"Diff","identifiers":["diff","udiff","patch"],"codemirror_mode":"diff","codemirror_mime_type":"text/x-diff"},{"label":"Dockerfile","identifiers":["dockerfile"],"codemirror_mode":"dockerfile","codemirror_mime_type":"text/x-dockerfile"},{"label":"Dylan","identifiers":["dylan","dyl","intr","lid"],"codemirror_mode":"dylan","codemirror_mime_type":"text/x-dylan"},{"label":"EBNF","identifiers":["ebnf"],"codemirror_mode":"ebnf","codemirror_mime_type":"text/x-ebnf"},{"label":"ECL","identifiers":["ecl","eclxml"],"codemirror_mode":"ecl","codemirror_mime_type":"text/x-ecl"},{"label":"EQ","identifiers":["eq"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-csharp"},{"label":"Eagle","identifiers":["eagle","sch","brd"],"codemirror_mode":"xml","codemirror_mime_type":"text/xml"},{"label":"Easybuild","identifiers":["easybuild","eb"],"codemirror_mode":"python","codemirror_mime_type":"text/x-python"},{"label":"Ecere Projects","identifiers":["epj"],"codemirror_mode":"javascript","codemirror_mime_type":"application/json"},{"label":"EditorConfig","identifiers":["editorconfig"],"codemirror_mode":"properties","codemirror_mime_type":"text/x-properties"},{"label":"Edje Data Collection","identifiers":["edc"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-c++src"},{"label":"Eiffel","identifiers":["eiffel","e"],"codemirror_mode":"eiffel","codemirror_mime_type":"text/x-eiffel"},{"label":"Elm","identifiers":["elm"],"codemirror_mode":"elm","codemirror_mime_type":"text/x-elm"},{"label":"Emacs Lisp","identifiers":["elisp","emacs","el"],"codemirror_mode":"commonlisp","codemirror_mime_type":"text/x-common-lisp"},{"label":"EmberScript","identifiers":["emberscript","em"],"codemirror_mode":"coffeescript","codemirror_mime_type":"text/x-coffeescript"},{"label":"Erlang","identifiers":["erlang","erl","es","escript","hrl","xrl","yrl"],"codemirror_mode":"erlang","codemirror_mime_type":"text/x-erlang"},{"label":"F#","identifiers":["fsharp","fs","fsi","fsx"],"codemirror_mode":"mllike","codemirror_mime_type":"text/x-fsharp"},{"label":"Factor","identifiers":["factor"],"codemirror_mode":"factor","codemirror_mime_type":"text/x-factor"},{"label":"Forth","identifiers":["forth","fth","f","for","fr","frt","fs"],"codemirror_mode":"forth","codemirror_mime_type":"text/x-forth"},{"label":"Fortran","identifiers":["fortran","f","for","fpp"],"codemirror_mode":"fortran","codemirror_mime_type":"text/x-fortran"},{"label":"GCC Machine Description","identifiers":["md"],"codemirror_mode":"commonlisp","codemirror_mime_type":"text/x-common-lisp"},{"label":"GN","identifiers":["gn","gni"],"codemirror_mode":"python","codemirror_mime_type":"text/x-python"},{"label":"Game Maker Language","identifiers":["gml"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-c++src"},{"label":"Genshi","identifiers":["genshi","kid"],"codemirror_mode":"xml","codemirror_mime_type":"text/xml"},{"label":"Gentoo Ebuild","identifiers":["ebuild"],"codemirror_mode":"shell","codemirror_mime_type":"text/x-sh"},{"label":"Gentoo Eclass","identifiers":["eclass"],"codemirror_mode":"shell","codemirror_mime_type":"text/x-sh"},{"label":"Git Attributes","identifiers":["gitattributes"],"codemirror_mode":"shell","codemirror_mime_type":"text/x-sh"},{"label":"Git Config","identifiers":["gitconfig","gitmodules"],"codemirror_mode":"properties","codemirror_mime_type":"text/x-properties"},{"label":"Glyph","identifiers":["glyph","glf"],"codemirror_mode":"tcl","codemirror_mime_type":"text/x-tcl"},{"label":"Go","identifiers":["go","golang"],"codemirror_mode":"go","codemirror_mime_type":"text/x-go"},{"label":"Grammatical Framework","identifiers":["gf"],"codemirror_mode":"haskell","codemirror_mime_type":"text/x-haskell"},{"label":"Groovy","identifiers":["groovy","grt","gtpl","gvy"],"codemirror_mode":"groovy","codemirror_mime_type":"text/x-groovy"},{"label":"Groovy Server Pages","identifiers":["gsp"],"codemirror_mode":"htmlembedded","codemirror_mime_type":"application/x-jsp"},{"label":"HCL","identifiers":["hcl","terraform","tf","tfvars","workflow"],"codemirror_mode":"ruby","codemirror_mime_type":"text/x-ruby"},{"label":"HTML","identifiers":["html","xhtml","htm","inc","st","xht"],"codemirror_mode":"htmlmixed","codemirror_mime_type":"text/html"},{"label":"HTML+Django","identifiers":["django","htmldjango","njk","nunjucks","jinja","mustache"],"codemirror_mode":"django","codemirror_mime_type":"text/x-django"},{"label":"HTML+ECR","identifiers":["ecr"],"codemirror_mode":"htmlmixed","codemirror_mime_type":"text/html"},{"label":"HTML+EEX","identifiers":["eex"],"codemirror_mode":"htmlmixed","codemirror_mime_type":"text/html"},{"label":"HTML+ERB","identifiers":["erb"],"codemirror_mode":"htmlembedded","codemirror_mime_type":"application/x-erb"},{"label":"HTML+PHP","identifiers":["phtml"],"codemirror_mode":"php","codemirror_mime_type":"application/x-httpd-php"},{"label":"HTML+Razor","identifiers":["razor","cshtml"],"codemirror_mode":"htmlmixed","codemirror_mime_type":"text/html"},{"label":"HTTP","identifiers":["http"],"codemirror_mode":"http","codemirror_mime_type":"message/http"},{"label":"Hack","identifiers":["hack","hh","php"],"codemirror_mode":"php","codemirror_mime_type":"application/x-httpd-php"},{"label":"Haml","identifiers":["haml"],"codemirror_mode":"haml","codemirror_mime_type":"text/x-haml"},{"label":"Haskell","identifiers":["haskell","hs","hsc"],"codemirror_mode":"haskell","codemirror_mime_type":"text/x-haskell"},{"label":"Haxe","identifiers":["haxe","hx","hxsl"],"codemirror_mode":"haxe","codemirror_mime_type":"text/x-haxe"},{"label":"HolyC","identifiers":["holyc","hc"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-csrc"},{"label":"IDL","identifiers":["idl","pro","dlm"],"codemirror_mode":"idl","codemirror_mime_type":"text/x-idl"},{"label":"INI","identifiers":["ini","dosini","cfg","lektorproject","prefs","pro","properties"],"codemirror_mode":"properties","codemirror_mime_type":"text/x-properties"},{"label":"IRC log","identifiers":["irc","irclog","weechatlog"],"codemirror_mode":"mirc","codemirror_mime_type":"text/mirc"},{"label":"Ignore List","identifiers":["ignore","gitignore"],"codemirror_mode":"shell","codemirror_mime_type":"text/x-sh"},{"label":"JSON","identifiers":["json","avsc","geojson","gltf","har","ice","jsonl","mcmeta","tfstate","topojson","webapp","webmanifest","yy","yyp"],"codemirror_mode":"javascript","codemirror_mime_type":"application/json"},{"label":"JSON with Comments","identifiers":["jsonc"],"codemirror_mode":"javascript","codemirror_mime_type":"text/javascript"},{"label":"JSON5","identifiers":[],"codemirror_mode":"javascript","codemirror_mime_type":"application/json"},{"label":"JSONLD","identifiers":["jsonld"],"codemirror_mode":"javascript","codemirror_mime_type":"application/json"},{"label":"JSONiq","identifiers":["jsoniq","jq"],"codemirror_mode":"javascript","codemirror_mime_type":"application/json"},{"label":"JSX","identifiers":["jsx"],"codemirror_mode":"jsx","codemirror_mime_type":"text/jsx"},{"label":"Java","identifiers":["java"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-java"},{"label":"Java Properties","identifiers":["properties"],"codemirror_mode":"properties","codemirror_mime_type":"text/x-properties"},{"label":"Java Server Pages","identifiers":["jsp"],"codemirror_mode":"htmlembedded","codemirror_mime_type":"application/x-jsp"},{"label":"JavaScript","identifiers":["javascript","js","node","bones","es","frag","gs","jake","jsb","jscad","jsfl","jsm","jss","mjs","njs","pac","sjs","ssjs","xsjs","xsjslib"],"codemirror_mode":"javascript","codemirror_mime_type":"text/javascript"},{"label":"JavaScript+ERB","identifiers":[],"codemirror_mode":"javascript","codemirror_mime_type":"application/javascript"},{"label":"Julia","identifiers":["julia","jl"],"codemirror_mode":"julia","codemirror_mime_type":"text/x-julia"},{"label":"Jupyter Notebook","identifiers":["ipynb"],"codemirror_mode":"javascript","codemirror_mime_type":"application/json"},{"label":"KiCad Layout","identifiers":["pcbnew"],"codemirror_mode":"commonlisp","codemirror_mime_type":"text/x-common-lisp"},{"label":"Kit","identifiers":["kit"],"codemirror_mode":"htmlmixed","codemirror_mime_type":"text/html"},{"label":"Kotlin","identifiers":["kotlin","kt","ktm","kts"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-kotlin"},{"label":"LFE","identifiers":["lfe"],"codemirror_mode":"commonlisp","codemirror_mime_type":"text/x-common-lisp"},{"label":"LTspice Symbol","identifiers":["asy"],"codemirror_mode":"spreadsheet","codemirror_mime_type":"text/x-spreadsheet"},{"label":"LabVIEW","identifiers":["labview","lvproj"],"codemirror_mode":"xml","codemirror_mime_type":"text/xml"},{"label":"Latte","identifiers":["latte"],"codemirror_mode":"smarty","codemirror_mime_type":"text/x-smarty"},{"label":"Less","identifiers":["less"],"codemirror_mode":"css","codemirror_mime_type":"text/css"},{"label":"Literate Haskell","identifiers":["lhaskell","lhs"],"codemirror_mode":"haskell-literate","codemirror_mime_type":"text/x-literate-haskell"},{"label":"LiveScript","identifiers":["livescript","ls"],"codemirror_mode":"livescript","codemirror_mime_type":"text/x-livescript"},{"label":"LookML","identifiers":["lookml"],"codemirror_mode":"yaml","codemirror_mime_type":"text/x-yaml"},{"label":"Lua","identifiers":["lua","fcgi","nse","rbxs","wlua"],"codemirror_mode":"lua","codemirror_mime_type":"text/x-lua"},{"label":"M","identifiers":["m","mumps"],"codemirror_mode":"mumps","codemirror_mime_type":"text/x-mumps"},{"label":"MATLAB","identifiers":["matlab","octave","m"],"codemirror_mode":"octave","codemirror_mime_type":"text/x-octave"},{"label":"MTML","identifiers":["mtml"],"codemirror_mode":"htmlmixed","codemirror_mime_type":"text/html"},{"label":"MUF","identifiers":["muf","m"],"codemirror_mode":"forth","codemirror_mime_type":"text/x-forth"},{"label":"Makefile","identifiers":["makefile","bsdmake","make","mf","mak","d","mk","mkfile"],"codemirror_mode":"cmake","codemirror_mime_type":"text/x-cmake"},{"label":"Markdown","identifiers":["markdown","pandoc","md","mdown","mdwn","mdx","mkd","mkdn","mkdown","ronn","workbook"],"codemirror_mode":"gfm","codemirror_mime_type":"text/x-gfm"},{"label":"Marko","identifiers":["marko","markojs"],"codemirror_mode":"htmlmixed","codemirror_mime_type":"text/html"},{"label":"Mathematica","identifiers":["mathematica","mma","cdf","m","ma","mt","nb","nbp","wl","wlt"],"codemirror_mode":"mathematica","codemirror_mime_type":"text/x-mathematica"},{"label":"Maven POM","identifiers":[],"codemirror_mode":"xml","codemirror_mime_type":"text/xml"},{"label":"Max","identifiers":["max","maxmsp","maxpat","maxhelp","maxproj","mxt","pat"],"codemirror_mode":"javascript","codemirror_mime_type":"application/json"},{"label":"Metal","identifiers":["metal"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-c++src"},{"label":"Mirah","identifiers":["mirah","druby","duby"],"codemirror_mode":"ruby","codemirror_mime_type":"text/x-ruby"},{"label":"Modelica","identifiers":["modelica","mo"],"codemirror_mode":"modelica","codemirror_mime_type":"text/x-modelica"},{"label":"NSIS","identifiers":["nsis","nsi","nsh"],"codemirror_mode":"nsis","codemirror_mime_type":"text/x-nsis"},{"label":"NetLogo","identifiers":["netlogo","nlogo"],"codemirror_mode":"commonlisp","codemirror_mime_type":"text/x-common-lisp"},{"label":"NewLisp","identifiers":["newlisp","nl","lisp","lsp"],"codemirror_mode":"commonlisp","codemirror_mime_type":"text/x-common-lisp"},{"label":"Nginx","identifiers":["nginx","nginxconf","vhost"],"codemirror_mode":"nginx","codemirror_mime_type":"text/x-nginx-conf"},{"label":"Nu","identifiers":["nu","nush"],"codemirror_mode":"scheme","codemirror_mime_type":"text/x-scheme"},{"label":"NumPy","identifiers":["numpy","numpyw","numsc"],"codemirror_mode":"python","codemirror_mime_type":"text/x-python"},{"label":"OCaml","identifiers":["ocaml","ml","eliom","eliomi","mli","mll","mly"],"codemirror_mode":"mllike","codemirror_mime_type":"text/x-ocaml"},{"label":"Objective-C","identifiers":["objc","objectivec","m","h"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-objectivec"},{"label":"Objective-C++","identifiers":["mm"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-objectivec"},{"label":"OpenCL","identifiers":["opencl","cl"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-csrc"},{"label":"OpenRC runscript","identifiers":["openrc"],"codemirror_mode":"shell","codemirror_mime_type":"text/x-sh"},{"label":"Oz","identifiers":["oz"],"codemirror_mode":"oz","codemirror_mime_type":"text/x-oz"},{"label":"PHP","identifiers":["php","inc","aw","ctp","fcgi","phps","phpt"],"codemirror_mode":"php","codemirror_mime_type":"application/x-httpd-php"},{"label":"PLSQL","identifiers":["plsql","pls","bdy","ddl","fnc","pck","pkb","pks","plb","prc","spc","sql","tpb","tps","trg","vw"],"codemirror_mode":"sql","codemirror_mime_type":"text/x-plsql"},{"label":"PLpgSQL","identifiers":["plpgsql","pgsql","sql"],"codemirror_mode":"sql","codemirror_mime_type":"text/x-sql"},{"label":"Pascal","identifiers":["pascal","pas","dfm","dpr","inc","lpr","pp"],"codemirror_mode":"pascal","codemirror_mime_type":"text/x-pascal"},{"label":"Perl","identifiers":["perl","cperl","pl","al","cgi","fcgi","ph","plx","pm","psgi","t"],"codemirror_mode":"perl","codemirror_mime_type":"text/x-perl"},{"label":"Perl 6","identifiers":["nqp","pl","pm","t"],"codemirror_mode":"perl","codemirror_mime_type":"text/x-perl"},{"label":"Pic","identifiers":["pic","chem"],"codemirror_mode":"troff","codemirror_mime_type":"text/troff"},{"label":"Pod","identifiers":["pod"],"codemirror_mode":"perl","codemirror_mime_type":"text/x-perl"},{"label":"PowerShell","identifiers":["powershell","posh","pwsh"],"codemirror_mode":"powershell","codemirror_mime_type":"application/x-powershell"},{"label":"Protocol Buffer","identifiers":["protobuf","proto"],"codemirror_mode":"protobuf","codemirror_mime_type":"text/x-protobuf"},{"label":"Public Key","identifiers":["asc","pub"],"codemirror_mode":"asciiarmor","codemirror_mime_type":"application/pgp"},{"label":"Pug","identifiers":["pug","jade"],"codemirror_mode":"pug","codemirror_mime_type":"text/x-pug"},{"label":"Puppet","identifiers":["puppet","pp"],"codemirror_mode":"puppet","codemirror_mime_type":"text/x-puppet"},{"label":"PureScript","identifiers":["purescript","purs"],"codemirror_mode":"haskell","codemirror_mime_type":"text/x-haskell"},{"label":"Python","identifiers":["python","rusthon","py","bzl","cgi","fcgi","gyp","gypi","lmi","pyde","pyi","pyp","pyt","pyw","rpy","spec","tac","wsgi","xpy"],"codemirror_mode":"python","codemirror_mime_type":"text/x-python"},{"label":"R","identifiers":["r","R","Rscript","splus","rd","rsx"],"codemirror_mode":"r","codemirror_mime_type":"text/x-rsrc"},{"label":"RAML","identifiers":["raml"],"codemirror_mode":"yaml","codemirror_mime_type":"text/x-yaml"},{"label":"RHTML","identifiers":["rhtml"],"codemirror_mode":"htmlembedded","codemirror_mime_type":"application/x-erb"},{"label":"RMarkdown","identifiers":["rmarkdown","rmd"],"codemirror_mode":"gfm","codemirror_mime_type":"text/x-gfm"},{"label":"RPM Spec","identifiers":["specfile","spec"],"codemirror_mode":"rpm","codemirror_mime_type":"text/x-rpm-spec"},{"label":"Reason","identifiers":["reason","re","rei"],"codemirror_mode":"rust","codemirror_mime_type":"text/x-rustsrc"},{"label":"Roff","identifiers":["roff","groff","man","manpage","mdoc","nroff","troff","l","me","ms","n","nr","rno","tmac"],"codemirror_mode":"troff","codemirror_mime_type":"text/troff"},{"label":"Roff Manpage","identifiers":["man","mdoc"],"codemirror_mode":"troff","codemirror_mime_type":"text/troff"},{"label":"Rouge","identifiers":["rouge","rg"],"codemirror_mode":"clojure","codemirror_mime_type":"text/x-clojure"},{"label":"Ruby","identifiers":["ruby","jruby","macruby","rake","rb","rbx","builder","eye","fcgi","gemspec","god","jbuilder","mspec","pluginspec","podspec","rabl","rbuild","rbw","ru","spec","thor","watchr"],"codemirror_mode":"ruby","codemirror_mime_type":"text/x-ruby"},{"label":"Rust","identifiers":["rust","rs"],"codemirror_mode":"rust","codemirror_mime_type":"text/x-rustsrc"},{"label":"SAS","identifiers":["sas"],"codemirror_mode":"sas","codemirror_mime_type":"text/x-sas"},{"label":"SCSS","identifiers":["scss"],"codemirror_mode":"css","codemirror_mime_type":"text/x-scss"},{"label":"SPARQL","identifiers":["sparql","rq"],"codemirror_mode":"sparql","codemirror_mime_type":"application/sparql-query"},{"label":"SQL","identifiers":["sql","cql","ddl","inc","mysql","prc","tab","udf","viw"],"codemirror_mode":"sql","codemirror_mime_type":"text/x-sql"},{"label":"SQLPL","identifiers":["sqlpl","sql"],"codemirror_mode":"sql","codemirror_mime_type":"text/x-sql"},{"label":"SRecode Template","identifiers":["srt"],"codemirror_mode":"commonlisp","codemirror_mime_type":"text/x-common-lisp"},{"label":"SVG","identifiers":["svg"],"codemirror_mode":"xml","codemirror_mime_type":"text/xml"},{"label":"Sage","identifiers":["sage","sagews"],"codemirror_mode":"python","codemirror_mime_type":"text/x-python"},{"label":"SaltStack","identifiers":["saltstack","saltstate","salt","sls"],"codemirror_mode":"yaml","codemirror_mime_type":"text/x-yaml"},{"label":"Sass","identifiers":["sass"],"codemirror_mode":"sass","codemirror_mime_type":"text/x-sass"},{"label":"Scala","identifiers":["scala","kojo","sbt","sc"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-scala"},{"label":"Scheme","identifiers":["scheme","scm","sch","sld","sls","sps","ss"],"codemirror_mode":"scheme","codemirror_mime_type":"text/x-scheme"},{"label":"Shell","identifiers":["shell","sh","bash","zsh","bats","cgi","command","fcgi","ksh","tmux","tool"],"codemirror_mode":"shell","codemirror_mime_type":"text/x-sh"},{"label":"ShellSession","identifiers":["shellsession","console"],"codemirror_mode":"shell","codemirror_mime_type":"text/x-sh"},{"label":"Slim","identifiers":["slim"],"codemirror_mode":"slim","codemirror_mime_type":"text/x-slim"},{"label":"Smalltalk","identifiers":["smalltalk","squeak","st","cs"],"codemirror_mode":"smalltalk","codemirror_mime_type":"text/x-stsrc"},{"label":"Smarty","identifiers":["smarty","tpl"],"codemirror_mode":"smarty","codemirror_mime_type":"text/x-smarty"},{"label":"Squirrel","identifiers":["squirrel","nut"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-c++src"},{"label":"Standard ML","identifiers":["sml","ML","fun","sig"],"codemirror_mode":"mllike","codemirror_mime_type":"text/x-ocaml"},{"label":"Svelte","identifiers":["svelte"],"codemirror_mode":"htmlmixed","codemirror_mime_type":"text/html"},{"label":"Swift","identifiers":["swift"],"codemirror_mode":"swift","codemirror_mime_type":"text/x-swift"},{"label":"SystemVerilog","identifiers":["systemverilog","sv","svh","vh"],"codemirror_mode":"verilog","codemirror_mime_type":"text/x-systemverilog"},{"label":"TOML","identifiers":["toml"],"codemirror_mode":"toml","codemirror_mime_type":"text/x-toml"},{"label":"TSX","identifiers":["tsx"],"codemirror_mode":"jsx","codemirror_mime_type":"text/jsx"},{"label":"Tcl","identifiers":["tcl","adp","tm"],"codemirror_mode":"tcl","codemirror_mime_type":"text/x-tcl"},{"label":"Tcsh","identifiers":["tcsh","csh"],"codemirror_mode":"shell","codemirror_mime_type":"text/x-sh"},{"label":"TeX","identifiers":["tex","latex","aux","bbx","cbx","cls","dtx","ins","lbx","ltx","mkii","mkiv","mkvi","sty","toc"],"codemirror_mode":"stex","codemirror_mime_type":"text/x-stex"},{"label":"Terra","identifiers":["terra","t"],"codemirror_mode":"lua","codemirror_mime_type":"text/x-lua"},{"label":"Textile","identifiers":["textile"],"codemirror_mode":"textile","codemirror_mime_type":"text/x-textile"},{"label":"Turtle","identifiers":["turtle","ttl"],"codemirror_mode":"turtle","codemirror_mime_type":"text/turtle"},{"label":"Twig","identifiers":["twig"],"codemirror_mode":"twig","codemirror_mime_type":"text/x-twig"},{"label":"TypeScript","identifiers":["typescript","ts"],"codemirror_mode":"javascript","codemirror_mime_type":"application/typescript"},{"label":"Unified Parallel C","identifiers":["upc"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-csrc"},{"label":"Unity3D Asset","identifiers":["anim","asset","mat","meta","prefab","unity"],"codemirror_mode":"yaml","codemirror_mime_type":"text/x-yaml"},{"label":"Uno","identifiers":["uno"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-csharp"},{"label":"UnrealScript","identifiers":["unrealscript","uc"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-java"},{"label":"V","identifiers":["v","vlang"],"codemirror_mode":"go","codemirror_mime_type":"text/x-go"},{"label":"VHDL","identifiers":["vhdl","vhd","vhf","vhi","vho","vhs","vht","vhw"],"codemirror_mode":"vhdl","codemirror_mime_type":"text/x-vhdl"},{"label":"Verilog","identifiers":["verilog","v","veo"],"codemirror_mode":"verilog","codemirror_mime_type":"text/x-verilog"},{"label":"Visual Basic","identifiers":["vbnet","vb","bas","cls","frm","frx","vba","vbhtml","vbs"],"codemirror_mode":"vb","codemirror_mime_type":"text/x-vb"},{"label":"Volt","identifiers":["volt"],"codemirror_mode":"d","codemirror_mime_type":"text/x-d"},{"label":"WebAssembly","identifiers":["webassembly","wast","wasm","wat"],"codemirror_mode":"commonlisp","codemirror_mime_type":"text/x-common-lisp"},{"label":"WebIDL","identifiers":["webidl"],"codemirror_mode":"webidl","codemirror_mime_type":"text/x-webidl"},{"label":"Windows Registry Entries","identifiers":["reg"],"codemirror_mode":"properties","codemirror_mime_type":"text/x-properties"},{"label":"X BitMap","identifiers":["xbm"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-csrc"},{"label":"X PixMap","identifiers":["xpm","pm"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-csrc"},{"label":"XC","identifiers":["xc"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-csrc"},{"label":"XML","identifiers":["xml","rss","xsd","wsdl","adml","admx","ant","axml","builds","ccproj","ccxml","clixml","cproject","cscfg","csdef","csl","csproj","ct","depproj","dita","ditamap","ditaval","dotsettings","filters","fsproj","fxml","glade","gml","gmx","grxml","iml","ivy","jelly","jsproj","kml","launch","mdpolicy","mjml","mm","mod","mxml","natvis","ncl","ndproj","nproj","nuspec","odd","osm","pkgproj","pluginspec","proj","props","pt","rdf","resx","sch","scxml","sfproj","shproj","srdf","storyboard","targets","tml","ts","tsx","ui","urdf","ux","vbproj","vcxproj","vsixmanifest","vssettings","vstemplate","vxml","wixproj","workflow","wsf","wxi","wxl","wxs","xacro","xaml","xib","xlf","xliff","xmi","xproj","xspec","xul","zcml"],"codemirror_mode":"xml","codemirror_mime_type":"text/xml"},{"label":"XML Property List","identifiers":["plist","stTheme","tmCommand","tmLanguage","tmPreferences","tmSnippet","tmTheme"],"codemirror_mode":"xml","codemirror_mime_type":"text/xml"},{"label":"XPages","identifiers":["xpages"],"codemirror_mode":"xml","codemirror_mime_type":"text/xml"},{"label":"XProc","identifiers":["xproc","xpl"],"codemirror_mode":"xml","codemirror_mime_type":"text/xml"},{"label":"XQuery","identifiers":["xquery","xq","xql","xqm","xqy"],"codemirror_mode":"xquery","codemirror_mime_type":"application/xquery"},{"label":"XS","identifiers":["xs"],"codemirror_mode":"clike","codemirror_mime_type":"text/x-csrc"},{"label":"XSLT","identifiers":["xslt","xsl"],"codemirror_mode":"xml","codemirror_mime_type":"text/xml"},{"label":"YAML","identifiers":["yaml","yml","mir","reek","rviz","syntax"],"codemirror_mode":"yaml","codemirror_mime_type":"text/x-yaml"},{"label":"edn","identifiers":["edn"],"codemirror_mode":"clojure","codemirror_mime_type":"text/x-clojure"},{"label":"reStructuredText","identifiers":["restructuredtext","rst","rest"],"codemirror_mode":"rst","codemirror_mime_type":"text/x-rst"},{"label":"wisp","identifiers":["wisp"],"codemirror_mode":"clojure","codemirror_mime_type":"text/x-clojure"}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Data parsed from GitHub's linguist data file.
@@ -0,0 +1,6133 @@ | |||
# https://github.com/github/linguist/blob/d2e09563c19fe026873289bad3ceb586a1be09d7/lib/linguist/languages.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied from github/linguist.
@@ -0,0 +1,42 @@ | |||
const fs = require('fs-extra'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script for parsing the data we need from github/linguist data file.
@@ -0,0 +1,35 @@ | |||
import { reactSelectStyles, borders } from 'netlify-cms-ui-default'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Styles conforming to the theming API for react-select.
@@ -1,11 +1,11 @@ | |||
/** @jsx jsx */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes in this file are similar to the addition of unique draft keys - we're adding unique keys to list items to ensure state updates correctly across list position changes.
Node 8 hits EOL in a couple weeks, and its missing some bits that were causing failed tests like |
Ack Node 10 doesn't support Array.flat either |
}); | ||
|
||
describe('pressing backspace', () => { | ||
it('sets non-default block to default when empty', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests, as well as the others, execute multiple checks without fully resetting the environment. It isn't ideal as failures can cascade, but it saves a whole lot of time.
@@ -1,4 +1,14 @@ | |||
// Core |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replacing the type specific extension files with a single module for simplicity.
getEditorComponents, | ||
query, | ||
queryHits, | ||
clearSearch, | ||
clearFieldErrors, | ||
isFetching, | ||
loadEntry, | ||
isEditorComponent, | ||
isNewEditorComponent, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate concepts - sometimes a widget control behaves differently because it's an editor component, other times it needs to know if it was just inserted for things like autofocus.
const markdown = Plain.serialize(editor.value); | ||
const html = markdownToHtml(markdown, { getAsset, resolveWidget }); | ||
setEventTransfer(event, 'text', markdown); | ||
setEventTransfer(event, 'html', html); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy raw markdown and html, allow paste target to determine which it prefers.
isActive={selectionHasBlock} | ||
isHidden={this.isHidden('code-block')} | ||
disabled={disabled} | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code blocks must now be inserted. Greatly simplifies insertion logic and clarifies difference between inline code and block.
} | ||
} | ||
|
||
// If the old props/state values and new state value are all the same, and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced most of the logic below with dedicated plugins.
ref={this.processRef} | ||
spellCheck | ||
/> | ||
<InsertionPoint onClick={this.handleClickBelowDocument} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slate doesn't expand to fill available space, so we need to intelligently capture focus from clicks within the widget but below the editor.
this.state = { mode: localStorage.getItem(MODE_STORAGE_KEY) || 'visual' }; | ||
this.state = { | ||
mode: localStorage.getItem(MODE_STORAGE_KEY) || 'visual', | ||
pendingFocus: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pendingFocus
allows us to return focus to the newly instantiated editor after the Rich Text/Markdown toggle is activated.
const html = markdownToHtml(markdown, { getAsset, resolveWidget }); | ||
setEventTransfer(event, 'text', markdown); | ||
setEventTransfer(event, 'html', html); | ||
setEventTransfer(event, 'fragment', base64.serializeNode(editor.value.fragment)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy for text and html paste targets, as well as for Slate itself (copying and pasting within the editor).
@@ -0,0 +1,42 @@ | |||
const ForceInsert = ({ defaultType }) => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provides logic for creating a new block to focus when clicking above or below the leading and trailing blocks in the editor.
@@ -0,0 +1,14 @@ | |||
import isHotkey from 'is-hotkey'; | |||
|
|||
const SelectAll = () => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System select-all functionality doesn't work well in our Slate editor, this forces a proper selection.
@@ -0,0 +1,310 @@ | |||
import { Inline, Text } from 'slate'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A proper schema - it isn't exhaustive, but a great improvement over our previous setup.
*/ | ||
bullet: '*', | ||
emphasis: '*', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use underscores at all. This fixes some major parsing issues while introducing some edge cases, fair trade for now. The latest Slate, 0.52+, has a completely new model that mirrors MDAST, the model we're parsing Slate documents into. This should help address a whole lot of parsing issues and bring us very close to Commonmark compliance. The pending completion of micromark and subsequent update of remark to utilize it, which I believe allows MDAST to go from AST to CST, should allow us to stop transforming markdown documents needlessly and to reuse the specific characters already in place, Eg., asterisk vs. underscore.
@@ -1,31 +1,4 @@ | |||
import { isEmpty, isArray, last, flatMap } from 'lodash'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The heart of our markdown editor overhaul, together with slateRemark.js, this module parses MDAST to a Slate document.
@@ -1,5 +1,6 @@ | |||
import { get, isEmpty, without, flatMap, last, sortBy } from 'lodash'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This module parses a Slate document to MDAST.
cypress/plugins/github.js
Outdated
@@ -30,6 +30,8 @@ const FAKE_FORK_OWNER_USER = { | |||
}; | |||
|
|||
function getGitHubClient(token) { | |||
console.log('CLIENT') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove these right?
You can click the label and backspace, or click below the editor component and backspace (or drag to select and then backspace). Might not be apparent enough, though. Maybe an explicit “x” button would be worth adding. Sent with GitHawk |
* wip - upgrade to slate 0.43 * wip * wip * wip * wip * wip * wip * wip * finish list handling logic * add plugins directory * tests wip * setup testing * wip * add selection commands * finish list testing * stuff * add codemirror * abstract codemirror from slate * wip * wip * wip * wip * wip * wip * wip * wip * wip * codemirror mostly working, some bugs * upgrade to slate 46 * upgrade to slate 47 * wip * wip * progress * wip * mostly working links with surrounding marks * wip * tests passing * add test * fix formatting * update snapshots * close self closing tag in markdown html output * wip - commonmark * hold on commonmark work * all tests passing * fix e2e specs * ignore tests in esm builds * break/backspace plugins wip * finish enter/backspace spec * fix soft break handling * wip - editor component deletion * add insertion points * make insertion points invisible * fix empty mark nodes output to markdown * fix pasting * improve insertion points * add static bottom insertion point * improve click handling at insertion points * restore current table functionality * add paste support for Slate fragments * support cut/copy markdown, paste between rich/raw editor * fix copy paste * wip - paste/select bug fixing * fixed known slate issues * split plugins * fix editor toggles * force text cursor in code widget * wip - reorg plugins * finish markdown control reorg * configure plugin types * quote block adjacent handling with tests * wip * finish quote logic and tests * fix copy paste plugin migration regressions * fix force insert before node * fix trailing insertion point * remove empty headers * codemirror working properly in markdown widget * return focus to codemirror on lang select enter * fix state issues for widgets with local state * wip - vim working, just need to work out distribution * add settings pane * wip - default modes * fix deps * add programming language data * implement linguist langs in code widget * everything built in * remove old registration code, fix focus styling * fix/update linting setup * fix js lint errors * remove stylelint from format script * fix remaining linting errors * fix reducer test failures * chore: update commitlint for worktree support * chore: fix remaining tests * chore: drop unused monaco plugin * chore: remove extraneous global styles rendering * chore: fix failing tests * fix: tests * fix: quote/list nesting (tests still broken) * fix: update quote tests * chore: bring back code widget test config * fix: autofocus * fix: code blocks without the code widget * fix: code editor component state issues * fix: error * fix: add code block test, few fixes * chore: remove notes * fix: [wip] update stateful shortcodes on undo/redo * fix: support code styled links, handle unknown langs * fix: few fixes * fix: autofocus on insert, focus on all clicks * fix: linting * fix: autofocus * fix: update code block fixture * fix: remove unused cypress snapshot plugin * fix: drop node 8 test, add node 12 * fix: use lodash.flatten instead of Array.flat * fix: remove console logs
* wip - upgrade to slate 0.43 * wip * wip * wip * wip * wip * wip * wip * finish list handling logic * add plugins directory * tests wip * setup testing * wip * add selection commands * finish list testing * stuff * add codemirror * abstract codemirror from slate * wip * wip * wip * wip * wip * wip * wip * wip * wip * codemirror mostly working, some bugs * upgrade to slate 46 * upgrade to slate 47 * wip * wip * progress * wip * mostly working links with surrounding marks * wip * tests passing * add test * fix formatting * update snapshots * close self closing tag in markdown html output * wip - commonmark * hold on commonmark work * all tests passing * fix e2e specs * ignore tests in esm builds * break/backspace plugins wip * finish enter/backspace spec * fix soft break handling * wip - editor component deletion * add insertion points * make insertion points invisible * fix empty mark nodes output to markdown * fix pasting * improve insertion points * add static bottom insertion point * improve click handling at insertion points * restore current table functionality * add paste support for Slate fragments * support cut/copy markdown, paste between rich/raw editor * fix copy paste * wip - paste/select bug fixing * fixed known slate issues * split plugins * fix editor toggles * force text cursor in code widget * wip - reorg plugins * finish markdown control reorg * configure plugin types * quote block adjacent handling with tests * wip * finish quote logic and tests * fix copy paste plugin migration regressions * fix force insert before node * fix trailing insertion point * remove empty headers * codemirror working properly in markdown widget * return focus to codemirror on lang select enter * fix state issues for widgets with local state * wip - vim working, just need to work out distribution * add settings pane * wip - default modes * fix deps * add programming language data * implement linguist langs in code widget * everything built in * remove old registration code, fix focus styling * fix/update linting setup * fix js lint errors * remove stylelint from format script * fix remaining linting errors * fix reducer test failures * chore: update commitlint for worktree support * chore: fix remaining tests * chore: drop unused monaco plugin * chore: remove extraneous global styles rendering * chore: fix failing tests * fix: tests * fix: quote/list nesting (tests still broken) * fix: update quote tests * chore: bring back code widget test config * fix: autofocus * fix: code blocks without the code widget * fix: code editor component state issues * fix: error * fix: add code block test, few fixes * chore: remove notes * fix: [wip] update stateful shortcodes on undo/redo * fix: support code styled links, handle unknown langs * fix: few fixes * fix: autofocus on insert, focus on all clicks * fix: linting * fix: autofocus * fix: update code block fixture * fix: remove unused cypress snapshot plugin * fix: drop node 8 test, add node 12 * fix: use lodash.flatten instead of Array.flat * fix: remove console logs
Closes #2402 (and others below).
@erezrokah remember that massive PR I mentioned was coming? Here it is. Just a draft for now but will push to merge soon.
Includes:
Todo:
Followup:
Closes #2828 and others
The text was updated successfully, but these errors were encountered: