Skip to content
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

Pro 4504 inline figure #4281

Merged
merged 10 commits into from
Sep 8, 2023
Prev Previous commit
Next Next commit
figure should reset the wrapper
  • Loading branch information
haroun committed Aug 29, 2023

Verified

This commit was signed with the committer’s verified signature.
haroun haroun
commit 8ad089e404af6660a0e962a43652e48b55393d39
10 changes: 5 additions & 5 deletions modules/@apostrophecms/rich-text-widget/index.js
Original file line number Diff line number Diff line change
@@ -754,7 +754,7 @@ module.exports = {
// and start up your app, which will recreate them.
'remove-empty-paragraph': {
usage: 'Usage: node app @apostrophecms/rich-text-widget:remove-empty-paragraph\n\nTODO.\n',
task: async () => {
task: () => {
const iterator = async (doc, widget, dotPath) => {
if (widget.type !== self.name) {
return;
@@ -793,7 +793,7 @@ module.exports = {
},
'lint-fix': {
usage: 'Usage: node app @apostrophecms/rich-text-widget:lint-fix\n\nTODO.\n',
task: async () => {
task: () => {
const blockNodes = [
'address',
'article',
@@ -855,8 +855,8 @@ module.exports = {
let wrapper = null;

parent.each((index, element) => {
const isParagraphEmpty = element.type === 'tag' && element.name === 'p' && dom(element).text() === '';
isParagraphEmpty && dom(element).remove();
const isFigure = element.type === 'tag' && element.name === 'figure';
isFigure && (wrapper = null);

const isNonWhitespaceTextNode = element.type === 'text' && /^\s*$/.test(element.data) === false;
isNonWhitespaceTextNode && (wrapper = append({
@@ -872,7 +872,7 @@ module.exports = {
element
}));

const hasUpdate = isParagraphEmpty || isNonWhitespaceTextNode || isInlineNode;
const hasUpdate = isNonWhitespaceTextNode || isInlineNode;
if (hasUpdate) {
updates[dotPath] = {
...widget,