mirror of https://github.com/fantasticit/think.git
Merge pull request #21 from fantasticit/bugfix/title
This commit is contained in:
commit
e7a70622d4
|
@ -19,8 +19,6 @@ declare module '@tiptap/core' {
|
||||||
export const Title = Node.create<TitleOptions>({
|
export const Title = Node.create<TitleOptions>({
|
||||||
name: 'title',
|
name: 'title',
|
||||||
content: 'inline*',
|
content: 'inline*',
|
||||||
group: 'block',
|
|
||||||
defining: true,
|
|
||||||
|
|
||||||
addOptions() {
|
addOptions() {
|
||||||
return {
|
return {
|
||||||
|
@ -61,11 +59,12 @@ export const Title = Node.create<TitleOptions>({
|
||||||
|
|
||||||
const $head = state.selection.$head;
|
const $head = state.selection.$head;
|
||||||
const titleNode = $head.node($head.depth);
|
const titleNode = $head.node($head.depth);
|
||||||
const insertPos = titleNode.firstChild.nodeSize + 1;
|
const endPos = titleNode.firstChild.nodeSize + 1;
|
||||||
dispatch(state.tr.insert(insertPos, paragraph.create()));
|
|
||||||
|
dispatch(state.tr.insert(endPos, paragraph.create()));
|
||||||
|
|
||||||
const newState = view.state;
|
const newState = view.state;
|
||||||
const next = new TextSelection(newState.doc.resolve(insertPos + 1));
|
const next = new TextSelection(newState.doc.resolve(endPos + 2));
|
||||||
dispatch(newState.tr.setSelection(next));
|
dispatch(newState.tr.setSelection(next));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
code {
|
code {
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
font-family: Consolas, Menlo, Courier, monospace;
|
font-family: Consolas, Menlo, Courier, monospace;
|
||||||
font-size: .875rem;
|
font-size: 0.875rem;
|
||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
cursor: text;
|
cursor: text;
|
||||||
background-color: var(--semi-color-fill-1);
|
background-color: var(--semi-color-fill-1);
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 8px;
|
margin: 8px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
font-size: .875rem;
|
font-size: 0.875rem;
|
||||||
line-height: 1.5rem;
|
line-height: 1.5rem;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
white-space: pre;
|
white-space: pre;
|
||||||
|
@ -33,6 +33,12 @@
|
||||||
overscroll-behavior: contain;
|
overscroll-behavior: contain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.node-codeBlock {
|
||||||
|
&::before {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -276,6 +282,6 @@ body[theme-mode='dark'] {
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
opacity: .75;
|
opacity: 0.75;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
.wrap {
|
.wrap {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
margin-top: 0.75em;
|
||||||
|
|
||||||
.handleWrap {
|
.handleWrap {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
Loading…
Reference in New Issue