Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f38fe21
feat(plate): add as new widget, basic marks
demshy Mar 22, 2024
4ec4983
feat(richtext): add paragraphs and headings, refactor some
demshy Mar 27, 2024
899990b
feat(richtext): add basic listsr
demshy Mar 27, 2024
e7e110b
feat(richtext): add serializers, update tests
demshy Mar 27, 2024
7cd2eee
feat(richtext): add link plugin
demshy Mar 28, 2024
75c1fa3
feat(richtext): add blockquote
demshy Mar 29, 2024
ab5132e
feat(richtext): add blockquote plugin special keydown events
demshy Apr 4, 2024
181d644
feat(richtext): use own querynode
demshy Apr 4, 2024
c6ac950
feat(richtext): use getBlockAbove for heading state
demshy Aug 8, 2024
08c14c8
feat(richtext): add blockquote toolbar button state
demshy Aug 8, 2024
c0b12f9
feat(richtext): add editor components to toolbar
demshy Aug 8, 2024
50092e0
chore(eslimt): update eslint config to allow package.json exports pro…
demshy Oct 23, 2024
dee442d
feat(richtext): upgrade plate to 39, add shortcodes
demshy Oct 23, 2024
86fcc39
feat(richtext): clean up some logs
demshy Oct 23, 2024
c8b1c59
Merge branch 'main' into widget-richtext
martinjagodic Jun 26, 2025
a418dc0
Merge branch 'main' into widget-richtext
demshy Sep 30, 2025
4802720
chore(): update slate to 0.110
demshy Oct 1, 2025
0025e18
chore: update slate and related dependencies to latest versions
demshy Oct 1, 2025
6960730
Merge branch 'chore/slate-116' into widget-richtext
demshy Oct 1, 2025
f0fb7a8
chore: change remark versions to the ones that work with our tokenize…
demshy Oct 1, 2025
db48a9a
feat(widget-richtext): update plate to v50, temporary disable editor …
Oct 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ module.exports = {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
exports: {},
},
'import/core-modules': [...packages, 'decap-cms-app/dist/esm'],
},
Expand Down
4 changes: 3 additions & 1 deletion dev-test/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ collections: # A list of collections the CMS should be able to edit
required: false
tagname: ''

- { label: 'Body', name: 'body', widget: 'markdown', hint: 'Main content goes here.' }
- { label: 'Body', name: 'body', widget: 'richtext', hint: 'Main content goes here.' }
- { label: 'Body', name: 'bodyold', widget: 'markdown', hint: 'Main content goes here.' }
- { label: 'Body', name: 'bodyold2', widget: 'markdown', hint: 'Main content goes here 2.' }

- name: 'restaurants' # Used in routes, ie.: /admin/collections/:slug/edit
label: 'Restaurants' # Used in the UI
Expand Down
7,203 changes: 805 additions & 6,398 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"cypress-plugin-tab": "^1.0.0",
"dotenv": "^10.0.0",
"eslint": "^8.12.0",
"eslint-import-resolver-exports": "^1.0.0-beta.5",
"eslint-plugin-cypress": "^2.6.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-prettier": "^4.0.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/decap-cms-app/src/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import DecapCmsWidgetImage from 'decap-cms-widget-image';
import DecapCmsWidgetFile from 'decap-cms-widget-file';
import DecapCmsWidgetSelect from 'decap-cms-widget-select';
import DecapCmsWidgetMarkdown from 'decap-cms-widget-markdown';
import DecapCmsWidgetRichtext from 'decap-cms-widget-richtext';
import DecapCmsWidgetList from 'decap-cms-widget-list';
import DecapCmsWidgetObject from 'decap-cms-widget-object';
import DecapCmsWidgetRelation from 'decap-cms-widget-relation';
Expand Down Expand Up @@ -49,6 +50,7 @@ CMS.registerWidget([
DecapCmsWidgetFile.Widget(),
DecapCmsWidgetSelect.Widget(),
DecapCmsWidgetMarkdown.Widget(),
DecapCmsWidgetRichtext.Widget(),
DecapCmsWidgetList.Widget(),
DecapCmsWidgetObject.Widget(),
DecapCmsWidgetRelation.Widget(),
Expand Down
11 changes: 6 additions & 5 deletions packages/decap-cms-widget-markdown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@
"remark-slate": "^1.8.6",
"remark-slate-transformer": "^0.7.4",
"remark-stringify": "^6.0.4",
"slate": "^0.91.1",
"slate": "^0.118.1",
"slate-base64-serializer": "^0.2.107",
"slate-history": "^0.93.0",
"slate-hyperscript": "^0.77.0",
"slate-plain-serializer": "^0.7.1",
"slate-react": "^0.91.2",
"slate-dom": "^0.118.1",
"slate-history": "^0.113.1",
"slate-hyperscript": "^0.100.0",
"slate-plain-serializer": "^0.7.3",
"slate-react": "^0.117.4",
"slate-soft-break": "^0.9.0",
"unified": "^9.2.0",
"unist-builder": "^1.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ function Editor(props) {
position: relative;
`}
>
<Slate editor={editor} value={editorValue} onChange={handleChange}>
<Slate editor={editor} value={editorValue} initialValue={editorValue} onChange={handleChange}>
<EditorControlBar>
{
<Toolbar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function VoidBlock({ attributes, children, element }) {
insertAtPath([...path.slice(0, -1), path[path.length - 1] + 1]);
}


const insertBefore = path[0] === 0;
const nextElement = editor.children[path[0] + 1];
const insertAfter = path[0] === editor.children.length - 1 || editor.isVoid(nextElement);
Expand Down
3 changes: 3 additions & 0 deletions packages/decap-cms-widget-markdown/src/serializers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@ export function markdownToSlate(markdown, { voidCodeBlock, remarkPlugins = [] }
* trees.
*/
export function slateToMarkdown(raw, { voidCodeBlock, remarkPlugins = [] } = {}) {
console.log('old raw', raw);
const mdast = slateToRemark(raw, { voidCodeBlock });
console.log('old mdast', mdast);
const markdown = remarkToMarkdown(mdast, remarkPlugins);
console.log('old md', markdown);
return markdown;
}
9 changes: 9 additions & 0 deletions packages/decap-cms-widget-richtext/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Docs coming soon!

Decap CMS was converted from a single npm package to a "monorepo" of over 20 packages.
We haven't created a README for this package yet, but you can:

1. Check out the [main readme](https://github.com/decaporg/decap-cms/#readme) or the [documentation
site](https://www.decapcms.org) for more info.
2. Reach out to the [community chat](https://decapcms.org/chat/) if you need help.
3. Help out and [write the readme yourself](https://github.com/decaporg/decap-cms/edit/master/packages/decap-cms-widget-markdown/README.md)!
46 changes: 46 additions & 0 deletions packages/decap-cms-widget-richtext/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "decap-cms-widget-richtext",
"description": "Widget for editing richtext in Decap CMS.",
"version": "3.1.0",
"homepage": "https://www.decapcms.org/docs/widgets/#richtext",
"repository": "https://github.com/decaporg/decap-cms/tree/master/packages/decap-cms-widget-richtext",
"bugs": "https://github.com/decaporg/decap-cms/issues",
"module": "dist/esm/index.js",
"main": "dist/decap-cms-widget-richtext.js",
"license": "MIT",
"keywords": [
"decap-cms",
"widget",
"richtext",
"editor"
],
"sideEffects": false,
"scripts": {
"develop": "npm run build:esm -- --watch",
"build": "cross-env NODE_ENV=production webpack",
"build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore \"**/__tests__\" --root-mode upward --copy-files --extensions \".js,.jsx,.ts,.tsx\""
},
"dependencies": {
"@platejs/basic-nodes": "^49.0.0",
"@platejs/link": "^50.2.7",
"@platejs/list": "^50.2.0",
"@platejs/list-classic": "^49.1.0",
"class-variance-authority": "^0.7.0",
"lucide-react": "^0.331.0",
"platejs": "^49.2.21",
"remark-parse": "^6.0.3",
"remark-rehype": "^4.0.0",
"unified": "^9.0.0"
},
"peerDependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"decap-cms-ui-default": "^3.0.0",
"immutable": "^3.7.6",
"lodash": "^4.17.11",
"prop-types": "^15.7.2",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-immutable-proptypes": "^2.1.0"
}
}
44 changes: 44 additions & 0 deletions packages/decap-cms-widget-richtext/src/RichtextControl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';

import VisualEditor from './RichtextControl/VisualEditor';
import { EditorProvider } from './RichtextControl/editorContext';

export default class MarkdownControl extends React.Component {
static propTypes = {
onChange: PropTypes.func.isRequired,
onAddAsset: PropTypes.func.isRequired,
getAsset: PropTypes.func.isRequired,
classNameWrapper: PropTypes.string.isRequired,
editorControl: PropTypes.elementType.isRequired,
value: PropTypes.string,
field: ImmutablePropTypes.map.isRequired,
getEditorComponents: PropTypes.func,
t: PropTypes.func.isRequired,
isDisabled: PropTypes.bool,
};


render() {
const { classNameWrapper, field, t, isDisabled, getEditorComponents, editorControl, onChange, value } =
this.props;

const visualEditor = (
<EditorProvider editorControl={editorControl} editorComponents={getEditorComponents()}>
<div className="cms-editor-visual" ref={this.processRef}>
<VisualEditor
t={t}
field={field}
className={classNameWrapper}
getEditorComponents={getEditorComponents}
isDisabled={isDisabled}
onChange={onChange}
value={value}
/>
</div>
</EditorProvider>
);
return visualEditor;
}
}
Loading
Loading