fix(Jeditor): prevent auto h1 on empty editor and paste

This commit is contained in:
jingrow 2025-11-16 15:47:52 +08:00
parent c355e649ad
commit 7ff17ffee3

View File

@ -644,7 +644,7 @@ function mountControl() {
editable: !props.disabled,
extensions: [
Document.extend({
content: '(heading | paragraph | blockquote | codeBlock | horizontalRule | customDiv | table | bulletList | orderedList | taskList)+',
content: '(paragraph | heading | blockquote | codeBlock | horizontalRule | customDiv | table | bulletList | orderedList | taskList)+',
}),
CustomDiv,
Paragraph,
@ -974,110 +974,5 @@ watch(() => props.disabled, (disabled) => {
max-width: 100% !important;
width: auto !important;
}
/* 表格标准样式 */
.jeditor table {
border-collapse: collapse;
border-spacing: 0;
width: 100%;
margin: 12px 0;
overflow: hidden;
border: 1px solid #e5e7eb;
border-radius: 6px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.jeditor table td,
.jeditor table th {
min-width: 1em;
padding: 8px 12px;
border: 1px solid #e5e7eb;
vertical-align: top;
box-sizing: border-box;
position: relative;
background-color: #fff;
}
.jeditor table th {
font-weight: 600;
text-align: left;
background-color: #f8f9fa;
color: #374151;
border-bottom: 2px solid #e5e7eb;
}
.jeditor table td {
background-color: #fff;
color: #1f2937;
}
/* 表格选中状态 */
.jeditor table .selectedCell:after {
z-index: 2;
position: absolute;
content: "";
left: 0; right: 0; top: 0; bottom: 0;
background: rgba(31, 199, 111, 0.1);
pointer-events: none;
}
.jeditor table .column-resize-handle {
position: absolute;
right: -2px;
top: 0;
bottom: -2px;
width: 4px;
background-color: #1fc76f;
pointer-events: none;
opacity: 0;
transition: opacity 0.2s ease;
}
.jeditor table:hover .column-resize-handle,
.jeditor table .column-resize-handle.selected {
opacity: 1;
}
/* 表格行悬浮效果 */
.jeditor table tr:hover td {
background-color: #f9fafb;
}
.jeditor table tr:hover th {
background-color: #f1f3f5;
}
/* 表格响应式处理 */
.jeditor .ProseMirror {
overflow-x: auto;
}
/* 当表格过宽时,允许横向滚动 */
.jeditor table {
max-width: 100%;
display: table;
}
.jeditor table td,
.jeditor table th {
white-space: normal;
word-wrap: break-word;
}
/* 表格编辑时的焦点样式 */
.jeditor table td:focus,
.jeditor table th:focus {
outline: 2px solid #1fc76f;
outline-offset: -2px;
}
/* 表格空单元格样式 */
.jeditor table td p.is-editor-empty:first-child::before {
content: attr(data-placeholder);
float: left;
color: #adb5bd;
pointer-events: none;
height: 0;
}
</style>