Skip to content

Commit

Permalink
Merge pull request #3 from eea/develop
Browse files Browse the repository at this point in the history
Fix show multiple footnotes for the same citation on copy paste
  • Loading branch information
avoinea authored Jan 5, 2021
2 parents 7ae4302 + 7c01ec2 commit 84f70cc
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Blocks/Footnote/FootnotesBlockView.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import { Node } from 'slate';
import {
getBlocksFieldname,
getBlocksLayoutFieldname,
} from '@plone/volto/helpers';
import React from 'react';
import { Node } from 'slate';
import { settings } from '~/config';
import './less/public.less';

Expand Down Expand Up @@ -69,7 +69,13 @@ const FootnotesBlockView = (props) => {
if (!value) return;

Array.from(Node.elements(value[0])).forEach(([node]) => {
if (footnotes.includes(node.type)) {
if (
footnotes.includes(node.type) &&
// do not add duplicates coming from copy/paste of notes
notes.filter((note) => {
return node.data && note.data.uid === node.data.uid;
}).length === 0
) {
notes.push(node);
}
});
Expand Down

0 comments on commit 84f70cc

Please sign in to comment.