chore: merge

This commit is contained in:
James
2021-12-20 10:37:18 -05:00
7 changed files with 30 additions and 5 deletions

View File

@@ -58,6 +58,7 @@
.rich-text-link__url {
@include formInput;
padding-right: base(1.75);
min-width: base(12);
width: 100%;
background: rgba($color-background-gray, .1);

View File

@@ -69,6 +69,7 @@ const Link = ({ attributes, children, element }) => {
}}
onKeyDown={(e) => {
if (e.key === 'Enter') {
e.preventDefault();
close();
}
}}

View File

@@ -9,13 +9,21 @@ export const unwrapLink = (editor: Editor): void => {
Transforms.unwrapNodes(editor, { match: (n) => Element.isElement(n) && n.type === 'link' });
};
export const wrapLink = (editor: Editor, url?: string, newTab?: boolean): void => {
export const wrapLink = (editor, url?: string, newTab?: boolean): void => {
if (isLinkActive(editor)) {
unwrapLink(editor);
}
const { selection } = editor;
const isCollapsed = selection && Range.isCollapsed(selection);
const { selection, blurSelection } = editor;
if (blurSelection) {
Transforms.select(editor, blurSelection);
}
const selectionToUse = selection || blurSelection;
const isCollapsed = selectionToUse && Range.isCollapsed(selectionToUse);
const link = {
type: 'link',
url,

View File

@@ -50,6 +50,12 @@ const EditView: React.FC<IndexProps> = (props) => {
const state = await buildStateFromSchema(fields, json.doc);
setInitialState(state);
setSubmissionCount((count) => count + 1);
history.push({
state: {
data: json.doc,
},
});
}
};