mirror of https://github.com/fantasticit/think.git
tiptap: add default title when empty and can't editable
This commit is contained in:
parent
28fe0c361a
commit
698680455e
|
@ -1,4 +1,5 @@
|
||||||
.wrap {
|
.wrap {
|
||||||
|
position: relative;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
||||||
.coverWrap {
|
.coverWrap {
|
||||||
|
@ -27,19 +28,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.emoji {
|
.emptyTitle {
|
||||||
display: inline-block;
|
position: absolute;
|
||||||
width: 78px;
|
height: 0;
|
||||||
height: 78px;
|
pointer-events: none;
|
||||||
font-size: 78px;
|
|
||||||
font-weight: normal;
|
|
||||||
line-height: 78px;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
&:hover,
|
|
||||||
&:focus,
|
|
||||||
&:focus-within {
|
|
||||||
background-color: var(--semi-color-fill-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ const images = [
|
||||||
export const TitleWrapper = ({ editor, node }) => {
|
export const TitleWrapper = ({ editor, node }) => {
|
||||||
const isEditable = editor.isEditable;
|
const isEditable = editor.isEditable;
|
||||||
const { cover } = node.attrs;
|
const { cover } = node.attrs;
|
||||||
|
const hasTitleContent = node.content.size > 0;
|
||||||
|
|
||||||
const setCover = useCallback(
|
const setCover = useCallback(
|
||||||
(cover) => {
|
(cover) => {
|
||||||
|
@ -62,6 +63,7 @@ export const TitleWrapper = ({ editor, node }) => {
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
{!isEditable && !hasTitleContent && <span className={styles.emptyTitle}>未命名文档</span>}
|
||||||
<NodeViewContent></NodeViewContent>
|
<NodeViewContent></NodeViewContent>
|
||||||
</NodeViewWrapper>
|
</NodeViewWrapper>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue