@a200888213/gbdocx 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/index.html +2 -1
- package/package.json +2 -1
- package/serve.mjs +3 -1
- package/src/app/word/edit.js +2 -2
- package/src/app/word/layout.js +5 -2
- package/src/app/word/view.js +30 -1
- package/src/app/word-app.js +30 -11
- package/src/kernel/docx/pageGeometry.js +2 -0
- package/src/kernel/editor/engine/blocksStructure.js +19 -1
- package/src/kernel/editor/engine/commands.js +1 -0
- package/src/kernel/editor/engine/dom.js +42 -18
- package/src/kernel/editor/engine/tableInteraction.js +17 -0
- package/src/kernel/editor/engine/tableOps.js +1 -5
- package/src/surface/editor-surface.js +131 -0
- package/src/ui/icons.js +100 -2
- package/src/ui/ribbon.js +485 -0
- package/src/ui/toolbar.js +2 -169
- package/styles/app.css +116 -116
- package/styles/tokens.css +5 -5
- package/styles/word-panel.css +9 -49
package/src/ui/toolbar.js
CHANGED
|
@@ -1,175 +1,8 @@
|
|
|
1
|
-
// [文件] gbdocx·
|
|
2
|
-
import { icon } from './icons.js';
|
|
1
|
+
// [文件] gbdocx·Select —— 功能区下拉(触发按钮 + 浮层条目;value 由 get() 现取)
|
|
3
2
|
import { openMenu } from './context-menu.js';
|
|
4
|
-
import { openColorPanel } from './color-panel.js';
|
|
5
|
-
import { ALIGN_OPTIONS, BG_COLORS, FONT_FAMILIES, FONT_SIZES, TEXT_COLORS } from '../kernel/textStyles.js';
|
|
6
|
-
import { PARA_STYLES } from '../kernel/docx/constants.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @param {object} io
|
|
10
|
-
* @param {() => object|null} io.getEditor
|
|
11
|
-
* @param {() => object} io.getState
|
|
12
|
-
* @param {() => boolean} io.isDisabled
|
|
13
|
-
* @param {object} io.actions {insertTable, insertImage, insertLink}
|
|
14
|
-
*/
|
|
15
|
-
export function buildToolbar(io) {
|
|
16
|
-
const bar = document.createElement('div');
|
|
17
|
-
bar.className = 'gbd-toolbar';
|
|
18
|
-
const refs = { buttons: {}, selects: {} };
|
|
19
|
-
|
|
20
|
-
const run = (name, ...args) => {
|
|
21
|
-
if (io.isDisabled()) return;
|
|
22
|
-
const ed = io.getEditor();
|
|
23
|
-
if (!ed || ed.destroyed) return io.getEditor();
|
|
24
|
-
ed.focus();
|
|
25
|
-
return ed.exec(name, ...args);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/* ---- 段落样式 / 字号 / 字体(下拉) ---- */
|
|
29
|
-
const group1 = document.createElement('div');
|
|
30
|
-
group1.className = 'gbd-toolbar__group';
|
|
31
|
-
refs.selects.block = makeSelect({
|
|
32
|
-
title: '段落样式',
|
|
33
|
-
width: 96,
|
|
34
|
-
options: PARA_STYLES.map((s) => ({ value: s.value, label: s.label })),
|
|
35
|
-
get: () => io.getState().blockType,
|
|
36
|
-
onChange: (v) => run('convertBlock', v),
|
|
37
|
-
});
|
|
38
|
-
refs.selects.size = makeSelect({
|
|
39
|
-
title: '字号',
|
|
40
|
-
width: 56,
|
|
41
|
-
options: [{ value: '', label: '默认' }, ...FONT_SIZES.map((s) => ({ value: s, label: String(s) }))],
|
|
42
|
-
get: () => Number.parseFloat(io.getState().fontSize) || '',
|
|
43
|
-
onChange: (v) => (v ? run('setFontSize', `${v}px`) : run('unsetFontSize')),
|
|
44
|
-
});
|
|
45
|
-
refs.selects.family = makeSelect({
|
|
46
|
-
title: '字体',
|
|
47
|
-
width: 110,
|
|
48
|
-
options: [{ value: '', label: '默认' }, ...FONT_FAMILIES.map((f) => ({ value: f.value, label: f.label, style: { fontFamily: f.value } }))],
|
|
49
|
-
get: () => io.getState().fontFamily || '',
|
|
50
|
-
onChange: (v) => (v ? run('setFontFamily', v) : run('unsetFontFamily')),
|
|
51
|
-
});
|
|
52
|
-
group1.append(refs.selects.block.el, refs.selects.size.el, refs.selects.family.el);
|
|
53
|
-
bar.appendChild(group1);
|
|
54
|
-
bar.appendChild(sep());
|
|
55
|
-
|
|
56
|
-
/* ---- 行内格式 ---- */
|
|
57
|
-
const group2 = document.createElement('div');
|
|
58
|
-
group2.className = 'gbd-toolbar__group';
|
|
59
|
-
const inline = [
|
|
60
|
-
['bold', '加粗 (Ctrl+B)', 'toggleBold'],
|
|
61
|
-
['italic', '斜体 (Ctrl+I)', 'toggleItalic'],
|
|
62
|
-
['underline', '下划线 (Ctrl+U)', 'toggleUnderline'],
|
|
63
|
-
['strike', '删除线', 'toggleStrike'],
|
|
64
|
-
['superscript', '上标 (Ctrl+=)', 'toggleSuperscript'],
|
|
65
|
-
['subscript', '下标 (Ctrl+Shift+=)', 'toggleSubscript'],
|
|
66
|
-
];
|
|
67
|
-
for (const [key, title, cmd] of inline) {
|
|
68
|
-
const b = toolButton(key, title, () => run(cmd));
|
|
69
|
-
b._stateKey = key;
|
|
70
|
-
group2.appendChild(b);
|
|
71
|
-
refs.buttons[key] = b;
|
|
72
|
-
}
|
|
73
|
-
const colorBtn = toolButton('colorIcon', '字体颜色', (e) => {
|
|
74
|
-
openColorPanel({ anchor: e.currentTarget, colors: TEXT_COLORS, value: io.getState().color, title: '字体颜色', columns: 10, onPick: (c) => run(c ? 'setColor' : 'unsetColor', c) });
|
|
75
|
-
});
|
|
76
|
-
const bgBtn = toolButton('bgIcon', '底色/高亮', (e) => {
|
|
77
|
-
openColorPanel({ anchor: e.currentTarget, colors: BG_COLORS, value: io.getState().backgroundColor, title: '背景色(高亮)', columns: 6, onPick: (c) => run(c ? 'setBackgroundColor' : 'unsetBackgroundColor', c) });
|
|
78
|
-
});
|
|
79
|
-
refs.buttons.color = colorBtn;
|
|
80
|
-
refs.buttons.bg = bgBtn;
|
|
81
|
-
group2.append(colorBtn, bgBtn);
|
|
82
|
-
bar.appendChild(group2);
|
|
83
|
-
bar.appendChild(sep());
|
|
84
|
-
|
|
85
|
-
/* ---- 对齐 / 列表 / 缩进 / 引用 / 代码 ---- */
|
|
86
|
-
const group3 = document.createElement('div');
|
|
87
|
-
group3.className = 'gbd-toolbar__group';
|
|
88
|
-
for (const a of ALIGN_OPTIONS) {
|
|
89
|
-
const b = toolButton(a.icon, a.title, () => run('setBlockAlign', a.value));
|
|
90
|
-
b._align = a.value;
|
|
91
|
-
group3.appendChild(b);
|
|
92
|
-
refs.buttons[`align-${a.value}`] = b;
|
|
93
|
-
}
|
|
94
|
-
const bl = toolButton('bullet', '无序列表', () => run('toggleBulletList'));
|
|
95
|
-
bl._stateKey = 'bulletList';
|
|
96
|
-
const ol = toolButton('ordered', '有序列表', () => run('toggleOrderedList'));
|
|
97
|
-
ol._stateKey = 'orderedList';
|
|
98
|
-
const indAdd = toolButton('indentAdd', '增加缩进', () => run('increaseBlockIndent'));
|
|
99
|
-
const indReduce = toolButton('indentReduce', '减少缩进', () => run('decreaseBlockIndent'));
|
|
100
|
-
const quote = toolButton('quote', '引用块', () => run('toggleBlockquote'));
|
|
101
|
-
quote._stateKey = 'blockquote';
|
|
102
|
-
const code = toolButton('code', '代码块', () => run('toggleCodeBlock'));
|
|
103
|
-
code._stateKey = 'codeBlock';
|
|
104
|
-
// 刷新只遍历 refs.buttons:不登记就永远拿不到激活态(点了列表/引用/代码块按钮后不亮)
|
|
105
|
-
refs.buttons.bullet = bl;
|
|
106
|
-
refs.buttons.ordered = ol;
|
|
107
|
-
refs.buttons.quote = quote;
|
|
108
|
-
refs.buttons.code = code;
|
|
109
|
-
group3.append(bl, ol, indAdd, indReduce, quote, code);
|
|
110
|
-
bar.appendChild(group3);
|
|
111
|
-
bar.appendChild(sep());
|
|
112
|
-
|
|
113
|
-
/* ---- 插入 ---- */
|
|
114
|
-
const group4 = document.createElement('div');
|
|
115
|
-
group4.className = 'gbd-toolbar__group';
|
|
116
|
-
group4.append(
|
|
117
|
-
toolButton('table', '插入表格', (e) => io.actions.insertTable(e)),
|
|
118
|
-
toolButton('image', '插入图片', () => io.actions.insertImage()),
|
|
119
|
-
toolButton('linkIcon', '插入链接', () => io.actions.insertLink()),
|
|
120
|
-
toolButton('divider', '分隔线', () => run('setHorizontalRule')),
|
|
121
|
-
toolButton('pageBreak', '分页符', () => run('insertPageBreak')),
|
|
122
|
-
);
|
|
123
|
-
bar.appendChild(group4);
|
|
124
|
-
bar.appendChild(sep());
|
|
125
|
-
|
|
126
|
-
/* ---- 撤销/重做/清除 ---- */
|
|
127
|
-
const group5 = document.createElement('div');
|
|
128
|
-
group5.className = 'gbd-toolbar__group';
|
|
129
|
-
refs.buttons.undo = toolButton('undo', '撤销 (Ctrl+Z)', () => run('undo'));
|
|
130
|
-
refs.buttons.redo = toolButton('redo', '重做 (Ctrl+Y)', () => run('redo'));
|
|
131
|
-
refs.buttons.clear = toolButton('clear', '清除格式', () => run('clearFormat'));
|
|
132
|
-
group5.append(refs.buttons.undo, refs.buttons.redo, refs.buttons.clear);
|
|
133
|
-
bar.appendChild(group5);
|
|
134
|
-
|
|
135
|
-
/** 按状态快照刷新激活态/禁用态 */
|
|
136
|
-
bar.refresh = () => {
|
|
137
|
-
const s = io.getState();
|
|
138
|
-
const disabled = io.isDisabled();
|
|
139
|
-
for (const [key, b] of Object.entries(refs.buttons)) {
|
|
140
|
-
if (b._stateKey) b.classList.toggle('gbd-is-active', Boolean(s[b._stateKey]));
|
|
141
|
-
if (b._align) b.classList.toggle('gbd-is-active', s.textAlign === b._align);
|
|
142
|
-
if (key === 'color') b.classList.toggle('gbd-is-active', Boolean(s.color));
|
|
143
|
-
if (key === 'bg') b.classList.toggle('gbd-is-active', Boolean(s.backgroundColor));
|
|
144
|
-
if (key === 'undo') b.disabled = disabled || !s.canUndo;
|
|
145
|
-
if (key === 'redo') b.disabled = disabled || !s.canRedo;
|
|
146
|
-
}
|
|
147
|
-
refs.selects.block.refresh();
|
|
148
|
-
refs.selects.size.refresh();
|
|
149
|
-
refs.selects.family.refresh();
|
|
150
|
-
};
|
|
151
|
-
return bar;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function sep() {
|
|
155
|
-
const s = document.createElement('span');
|
|
156
|
-
s.className = 'gbd-toolbar__sep';
|
|
157
|
-
return s;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function toolButton(name, title, onClick) {
|
|
161
|
-
const b = document.createElement('button');
|
|
162
|
-
b.type = 'button';
|
|
163
|
-
b.className = 'gbd-toolbtn';
|
|
164
|
-
b.title = title;
|
|
165
|
-
b.innerHTML = icon(name);
|
|
166
|
-
b.addEventListener('mousedown', (e) => e.preventDefault());
|
|
167
|
-
b.addEventListener('click', onClick);
|
|
168
|
-
return b;
|
|
169
|
-
}
|
|
170
3
|
|
|
171
4
|
/** 下拉选择(触发按钮 + 浮层条目;value 由 get() 现取) */
|
|
172
|
-
function makeSelect({ title, options, width, get, onChange }) {
|
|
5
|
+
export function makeSelect({ title, options, width, get, onChange }) {
|
|
173
6
|
const btn = document.createElement('button');
|
|
174
7
|
btn.type = 'button';
|
|
175
8
|
btn.className = 'gbd-select';
|
package/styles/app.css
CHANGED
|
@@ -46,6 +46,8 @@
|
|
|
46
46
|
min-height: var(--gbd-re-content-min-h, 100%);
|
|
47
47
|
width: var(--gbd-re-content-w, auto);
|
|
48
48
|
margin: var(--gbd-re-content-m, 0);
|
|
49
|
+
/* 正文随纸层一起下移,首行才落在纸的版心线上(纸层顶部留白见 --gbd-wd-sheet-top) */
|
|
50
|
+
margin-top: var(--gbd-wd-sheet-top, 0px);
|
|
49
51
|
padding: var(--gbd-re-content-pad, 14px 18px);
|
|
50
52
|
outline: none;
|
|
51
53
|
}
|
|
@@ -105,6 +107,50 @@
|
|
|
105
107
|
height: var(--gbd-re-handle-thickness);
|
|
106
108
|
border-radius: 0 0 999px 999px;
|
|
107
109
|
}
|
|
110
|
+
|
|
111
|
+
/* 表格移动手柄(⠿):悬停表时浮在纸面上层、落在纸的左边距里,单击选中整表、拖拽换位(Word 口径) */
|
|
112
|
+
.word-scope .rich-edit-surface .re-table-move {
|
|
113
|
+
position: absolute;
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
justify-content: center;
|
|
117
|
+
width: 14px;
|
|
118
|
+
height: 20px;
|
|
119
|
+
padding: 0;
|
|
120
|
+
border: none;
|
|
121
|
+
border-radius: 3px;
|
|
122
|
+
background: transparent;
|
|
123
|
+
color: var(--gbd-dt-text-secondary);
|
|
124
|
+
cursor: grab;
|
|
125
|
+
pointer-events: auto;
|
|
126
|
+
transition: background-color var(--gbd-dt-duration-fast) ease, color var(--gbd-dt-duration-fast) ease;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.word-scope .rich-edit-surface .re-table-move:hover {
|
|
130
|
+
background: var(--gbd-dt-accent-soft);
|
|
131
|
+
color: var(--gbd-dt-accent);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.word-scope .rich-edit-surface .re-table-move:active {
|
|
135
|
+
cursor: grabbing;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* 拖表落点线:贴目标块上/下沿的一根强调线(与列宽提示线同层) */
|
|
139
|
+
.word-scope .rich-edit-surface .re-drop-line {
|
|
140
|
+
position: absolute;
|
|
141
|
+
height: 2px;
|
|
142
|
+
margin-top: -1px;
|
|
143
|
+
border-radius: 1px;
|
|
144
|
+
background: var(--gbd-dt-accent);
|
|
145
|
+
pointer-events: none;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* 拖表手势期整面换抓取光标:table 内文字光标一并让位,松手即摘 */
|
|
149
|
+
.word-scope .rich-edit-surface.gbd-is-table-moving,
|
|
150
|
+
.word-scope .rich-edit-surface.gbd-is-table-moving * {
|
|
151
|
+
cursor: grabbing !important;
|
|
152
|
+
}
|
|
153
|
+
|
|
108
154
|
.word-scope .rich-edit-surface .re-table-select {
|
|
109
155
|
position: absolute;
|
|
110
156
|
box-sizing: border-box;
|
|
@@ -195,6 +241,8 @@
|
|
|
195
241
|
}
|
|
196
242
|
|
|
197
243
|
/* ==================== 应用外壳 ==================== */
|
|
244
|
+
/* [设计] 菜单栏 / 文档头 / 功能区 / 状态栏的视觉统一由 gbofficeui 提供;
|
|
245
|
+
本文件只保留应用骨架布局与正文区样式,不写第二份顶栏外观。 */
|
|
198
246
|
|
|
199
247
|
.word-scope .word-app {
|
|
200
248
|
display: flex;
|
|
@@ -203,35 +251,9 @@
|
|
|
203
251
|
min-height: 0;
|
|
204
252
|
}
|
|
205
253
|
|
|
206
|
-
.word-scope .word-head {
|
|
207
|
-
display: flex;
|
|
208
|
-
align-items: center;
|
|
209
|
-
gap: 6px;
|
|
210
|
-
padding: 4px 10px;
|
|
211
|
-
border-bottom: 1px solid var(--gbd-dt-border);
|
|
212
|
-
font-size: 13px;
|
|
213
|
-
}
|
|
214
|
-
.word-scope .word-head__title {
|
|
215
|
-
font-weight: 600;
|
|
216
|
-
}
|
|
217
|
-
.word-scope .word-head__path {
|
|
218
|
-
color: var(--gbd-dt-text-tertiary);
|
|
219
|
-
font-size: 12px;
|
|
220
|
-
}
|
|
221
254
|
.word-scope .word-head__dirty {
|
|
222
255
|
color: var(--gbd-dt-warning);
|
|
223
256
|
}
|
|
224
|
-
.word-scope .word-head__spacer {
|
|
225
|
-
flex: 1;
|
|
226
|
-
}
|
|
227
|
-
.word-scope .word-head__auto {
|
|
228
|
-
display: inline-flex;
|
|
229
|
-
align-items: center;
|
|
230
|
-
gap: 4px;
|
|
231
|
-
color: var(--gbd-dt-text-secondary);
|
|
232
|
-
font-size: 12px;
|
|
233
|
-
cursor: pointer;
|
|
234
|
-
}
|
|
235
257
|
|
|
236
258
|
.word-scope .word-main {
|
|
237
259
|
display: flex;
|
|
@@ -317,75 +339,9 @@
|
|
|
317
339
|
border-color: var(--gbd-dt-accent);
|
|
318
340
|
}
|
|
319
341
|
|
|
320
|
-
/* ====================
|
|
342
|
+
/* ==================== 下拉选择 ==================== */
|
|
343
|
+
/* 注:菜单栏 / 功能区内的尺寸与状态由 gbofficeui 统一,这里只留独立分发时的基础外观 */
|
|
321
344
|
|
|
322
|
-
.word-scope .gbd-menubar {
|
|
323
|
-
display: flex;
|
|
324
|
-
align-items: center;
|
|
325
|
-
gap: 2px;
|
|
326
|
-
padding: 2px 8px;
|
|
327
|
-
border-bottom: 1px solid var(--gbd-dt-border);
|
|
328
|
-
}
|
|
329
|
-
.word-scope .gbd-menubar__btn {
|
|
330
|
-
padding: 3px 10px;
|
|
331
|
-
border: none;
|
|
332
|
-
border-radius: 4px;
|
|
333
|
-
background: transparent;
|
|
334
|
-
color: var(--gbd-dt-text);
|
|
335
|
-
font-size: 13px;
|
|
336
|
-
cursor: pointer;
|
|
337
|
-
}
|
|
338
|
-
.word-scope .gbd-menubar__btn:hover,
|
|
339
|
-
.word-scope .gbd-menubar__btn.gbd-is-open {
|
|
340
|
-
background: var(--gbd-dt-hover);
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
/* ==================== 工具栏 ==================== */
|
|
344
|
-
|
|
345
|
-
.word-scope .gbd-toolbar {
|
|
346
|
-
display: flex;
|
|
347
|
-
flex-wrap: wrap;
|
|
348
|
-
align-items: center;
|
|
349
|
-
gap: 2px;
|
|
350
|
-
min-height: 44px;
|
|
351
|
-
padding: 4px 8px;
|
|
352
|
-
border-bottom: 1px solid var(--gbd-dt-border);
|
|
353
|
-
background: var(--gbd-dt-surface);
|
|
354
|
-
}
|
|
355
|
-
.word-scope .gbd-toolbar__group {
|
|
356
|
-
display: flex;
|
|
357
|
-
align-items: center;
|
|
358
|
-
gap: 1px;
|
|
359
|
-
}
|
|
360
|
-
.word-scope .gbd-toolbar__sep {
|
|
361
|
-
width: 1px;
|
|
362
|
-
height: 18px;
|
|
363
|
-
margin: 0 6px;
|
|
364
|
-
background: var(--gbd-dt-border-strong);
|
|
365
|
-
}
|
|
366
|
-
.word-scope .gbd-toolbtn {
|
|
367
|
-
width: 28px;
|
|
368
|
-
height: 28px;
|
|
369
|
-
display: grid;
|
|
370
|
-
place-items: center;
|
|
371
|
-
border: 1px solid transparent;
|
|
372
|
-
border-radius: 4px;
|
|
373
|
-
background: transparent;
|
|
374
|
-
color: var(--gbd-dt-text-secondary);
|
|
375
|
-
cursor: pointer;
|
|
376
|
-
}
|
|
377
|
-
.word-scope .gbd-toolbtn:hover {
|
|
378
|
-
background: var(--gbd-dt-hover);
|
|
379
|
-
color: var(--gbd-dt-text);
|
|
380
|
-
}
|
|
381
|
-
.word-scope .gbd-toolbtn.gbd-is-active {
|
|
382
|
-
background: var(--gbd-dt-accent-soft);
|
|
383
|
-
color: var(--gbd-dt-accent);
|
|
384
|
-
}
|
|
385
|
-
.word-scope .gbd-toolbtn:disabled {
|
|
386
|
-
opacity: 0.4;
|
|
387
|
-
cursor: default;
|
|
388
|
-
}
|
|
389
345
|
.word-scope .gbd-select {
|
|
390
346
|
display: inline-flex;
|
|
391
347
|
align-items: center;
|
|
@@ -404,37 +360,67 @@
|
|
|
404
360
|
overflow: hidden;
|
|
405
361
|
text-overflow: ellipsis;
|
|
406
362
|
white-space: nowrap;
|
|
363
|
+
/* button 的 UA 默认 text-align:center 会继承给 label,WPS 的字体框是左对齐 */
|
|
364
|
+
text-align: left;
|
|
407
365
|
}
|
|
408
366
|
.word-scope .gbd-select__caret {
|
|
409
367
|
color: var(--gbd-dt-text-tertiary);
|
|
410
368
|
}
|
|
411
369
|
|
|
412
|
-
/* ==================== 状态栏 ==================== */
|
|
413
370
|
|
|
414
|
-
|
|
371
|
+
/* ==================== 选项卡栏(Ribbon) ==================== */
|
|
372
|
+
/* 外壳 / 选项卡 / 分组 / 按钮的视觉由 gbofficeui/styles/office-chrome.css 统一,
|
|
373
|
+
本文件只保留 docx 专属的样式卡片(.gbd-rstyle)。 */
|
|
374
|
+
|
|
375
|
+
/* 样式卡片:样式名按自身字号预览(WPS 样式库口径),当前段落样式描边点亮 */
|
|
376
|
+
.word-scope .gbd-rstyle {
|
|
377
|
+
width: 56px;
|
|
378
|
+
height: 52px;
|
|
415
379
|
display: flex;
|
|
416
380
|
align-items: center;
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
border-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
}
|
|
424
|
-
.word-scope .gbd-statusbar__spacer {
|
|
425
|
-
flex: 1;
|
|
426
|
-
}
|
|
427
|
-
.word-scope .gbd-statusbar__btn {
|
|
428
|
-
padding: 2px 8px;
|
|
429
|
-
border: none;
|
|
430
|
-
border-radius: 4px;
|
|
431
|
-
background: transparent;
|
|
432
|
-
color: var(--gbd-dt-text-secondary);
|
|
433
|
-
font-size: 12px;
|
|
381
|
+
justify-content: center;
|
|
382
|
+
padding: 2px;
|
|
383
|
+
border: 1px solid var(--gbd-dt-border-strong);
|
|
384
|
+
border-radius: 6px;
|
|
385
|
+
background: var(--gbd-dt-bg);
|
|
386
|
+
color: var(--gbd-dt-text);
|
|
434
387
|
cursor: pointer;
|
|
388
|
+
overflow: hidden;
|
|
389
|
+
transition: background-color var(--gbd-dt-duration-fast) ease, border-color var(--gbd-dt-duration-fast) ease;
|
|
435
390
|
}
|
|
436
|
-
.word-scope .gbd-
|
|
391
|
+
.word-scope .gbd-rstyle:hover {
|
|
437
392
|
background: var(--gbd-dt-hover);
|
|
393
|
+
border-color: var(--gbd-dt-accent);
|
|
394
|
+
}
|
|
395
|
+
.word-scope .gbd-rstyle:focus-visible {
|
|
396
|
+
outline: 2px solid var(--gbd-dt-accent);
|
|
397
|
+
outline-offset: 1px;
|
|
398
|
+
}
|
|
399
|
+
.word-scope .gbd-rstyle.gbd-is-active {
|
|
400
|
+
border-color: var(--gbd-dt-accent);
|
|
401
|
+
background: var(--gbd-dt-accent-soft);
|
|
402
|
+
}
|
|
403
|
+
.word-scope .gbd-rstyle__preview {
|
|
404
|
+
font-size: 13px;
|
|
405
|
+
line-height: 1.2;
|
|
406
|
+
text-align: center;
|
|
407
|
+
white-space: nowrap;
|
|
408
|
+
color: var(--gbd-dt-text);
|
|
409
|
+
}
|
|
410
|
+
.word-scope .gbd-rstyle__preview--h1 {
|
|
411
|
+
font-size: 16px;
|
|
412
|
+
font-weight: 700;
|
|
413
|
+
}
|
|
414
|
+
.word-scope .gbd-rstyle__preview--h2 {
|
|
415
|
+
font-size: 15px;
|
|
416
|
+
font-weight: 700;
|
|
417
|
+
}
|
|
418
|
+
.word-scope .gbd-rstyle__preview--h3 {
|
|
419
|
+
font-size: 14px;
|
|
420
|
+
font-weight: 600;
|
|
421
|
+
}
|
|
422
|
+
.word-scope .gbd-rstyle.gbd-is-active .gbd-rstyle__preview {
|
|
423
|
+
color: var(--gbd-dt-accent);
|
|
438
424
|
}
|
|
439
425
|
|
|
440
426
|
/* ==================== 侧栏面板 ==================== */
|
|
@@ -910,11 +896,25 @@
|
|
|
910
896
|
word-break: break-word;
|
|
911
897
|
}
|
|
912
898
|
|
|
899
|
+
/* ==================== 预览模式 ==================== */
|
|
900
|
+
/* 只留文件头(标题/路径 + 退出预览)与正文;菜单、功能区、状态栏、侧栏等编辑界面全部收起 */
|
|
901
|
+
.word-scope .word-app.gb-is-preview .word-head__actions,
|
|
902
|
+
.word-scope .word-app.gb-is-preview .gbd-toolbar-host,
|
|
903
|
+
.word-scope .word-app.gb-is-preview .gbd-statusbar-host,
|
|
904
|
+
.word-scope .word-app.gb-is-preview .gbd-panel,
|
|
905
|
+
.word-scope .word-app.gb-is-preview .gbd-findbar,
|
|
906
|
+
.word-scope .word-app.gb-is-preview .word-chars-pop {
|
|
907
|
+
display: none;
|
|
908
|
+
}
|
|
909
|
+
/* 预览档本体也是只读档,但退出按钮不能被只读档的 55% 透明度压暗 */
|
|
910
|
+
.word-scope .word-app.gb-is-preview .word-head {
|
|
911
|
+
opacity: 1;
|
|
912
|
+
}
|
|
913
|
+
|
|
913
914
|
/* ==================== 只读档 ==================== */
|
|
914
915
|
/* 编辑控件已被 inert,压低视觉权重但不改底色;禁用态背景属状态反馈,不受静态背景约束 */
|
|
915
|
-
.word-scope .word-app.gb-is-readonly .word-head,
|
|
916
|
+
.word-scope .word-app.gb-is-readonly:not(.gb-is-preview) .word-head,
|
|
916
917
|
.word-scope .word-app.gb-is-readonly .gbd-toolbar-host { opacity: .55; }
|
|
917
|
-
.word-scope .gbd-menubar__btn:disabled { opacity: .5; cursor: default; }
|
|
918
918
|
|
|
919
919
|
/* ==================== 打印 ==================== */
|
|
920
920
|
@media print {
|
package/styles/tokens.css
CHANGED
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
--gbd-dt-accent-soft-strong: rgba(42, 107, 255, 0.3);
|
|
10
10
|
--gbd-dt-accent-fill: rgba(42, 107, 255, 0.42);
|
|
11
11
|
|
|
12
|
-
--gbd-dt-surface: #
|
|
12
|
+
--gbd-dt-surface: #ffffff;
|
|
13
13
|
--gbd-dt-surface-2: rgba(255, 255, 255, 0.72);
|
|
14
14
|
--gbd-dt-surface-3: rgba(255, 255, 255, 0.55);
|
|
15
15
|
|
|
16
16
|
--gbd-dt-bg: #ffffff;
|
|
17
|
-
--gbd-dt-bg-2: #
|
|
18
|
-
--gbd-dt-bg-3: #
|
|
19
|
-
--gbd-dt-scrim: #
|
|
17
|
+
--gbd-dt-bg-2: #ffffff;
|
|
18
|
+
--gbd-dt-bg-3: #ffffff;
|
|
19
|
+
--gbd-dt-scrim: #ffffff;
|
|
20
20
|
--gbd-dt-media-overlay: rgba(0, 0, 0, 0.68);
|
|
21
21
|
|
|
22
22
|
--gbd-dt-text: #171a1f;
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
color: var(--gbd-dt-text);
|
|
140
140
|
background: var(--gbd-dt-bg);
|
|
141
141
|
font-family: 'Microsoft YaHei', -apple-system, 'Segoe UI', sans-serif;
|
|
142
|
-
font-size:
|
|
142
|
+
font-size: 13px;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
.gbd-root {
|
package/styles/word-panel.css
CHANGED
|
@@ -28,9 +28,6 @@
|
|
|
28
28
|
--gbd-wd-option-active: #e2e6ed; /* 下拉项 active 底 */
|
|
29
29
|
--gbd-wd-option-pad: 5px; /* 下拉项内边距 */
|
|
30
30
|
--gbd-wd-option-gap: 5px 0; /* 下拉项纵向间距 */
|
|
31
|
-
--gbd-wd-item-size: 28px; /* 工具条目热区(保持本项目 28,不收敛 canvas 的 24) */
|
|
32
|
-
--gbd-wd-toolbar-h: 60px; /* 工具条视觉高度(min-height) */
|
|
33
|
-
--gbd-wd-statusbar-h: 30px; /* 状态栏高度 */
|
|
34
31
|
--gbd-wd-catalog-w: 250px; /* 目录侧栏宽度 */
|
|
35
32
|
--gbd-wd-comments-w: 250px; /* 批注侧栏宽度 */
|
|
36
33
|
}
|
|
@@ -53,14 +50,7 @@
|
|
|
53
50
|
background: var(--gbd-dt-bg);
|
|
54
51
|
}
|
|
55
52
|
|
|
56
|
-
/*
|
|
57
|
-
.word-scope .word-head {
|
|
58
|
-
display: flex;
|
|
59
|
-
align-items: center;
|
|
60
|
-
gap: 6px;
|
|
61
|
-
padding: 4px 10px;
|
|
62
|
-
border-bottom: 1px solid var(--gbd-dt-border);
|
|
63
|
-
}
|
|
53
|
+
/* 头部行:标题/路径/操作按钮的排版统一在 gbofficeui,应用侧不再覆盖 */
|
|
64
54
|
|
|
65
55
|
/* 主体行:目录面板 + 编辑面 + 批注面板横向排布;窄窗靠 flex 收缩消化(不写视口媒体查询) */
|
|
66
56
|
.word-scope .word-main {
|
|
@@ -77,8 +67,7 @@
|
|
|
77
67
|
min-width: 0;
|
|
78
68
|
min-height: 0;
|
|
79
69
|
|
|
80
|
-
/* [设计]
|
|
81
|
-
画布与纸面的层次由纸面阴影/边框给出,不用灰色填充铺底 */
|
|
70
|
+
/* [设计] 画布与纸面同为默认表面色(无灰色铺底):层次由纸面描边/投影给出 */
|
|
82
71
|
background: var(--gbd-dt-surface);
|
|
83
72
|
}
|
|
84
73
|
|
|
@@ -88,25 +77,6 @@
|
|
|
88
77
|
display: none !important;
|
|
89
78
|
}
|
|
90
79
|
|
|
91
|
-
/* ==================== 工具栏(docx 外层覆盖) ==================== */
|
|
92
|
-
|
|
93
|
-
/* [设计] office.scss 是办公三件套共用文件(三家共用禁各写一份),故工具栏的收窄调整一律在此用 docx 专属
|
|
94
|
-
外层类 .word-toolbar 覆盖,保持 office.scss 中性零改动,不波及 xlsx/pptx。
|
|
95
|
-
[约束] TopBar【强制通道】的行壳结构/收纳逻辑不动,这里只改视觉。 */
|
|
96
|
-
.word-scope .word-toolbar.of-toolbar {
|
|
97
|
-
/* 视觉高度向 canvas 工具条 60px 靠:content-box 加内边距,不改 TopBar 结构(条目仍 28×28) */
|
|
98
|
-
min-height: var(--gbd-wd-toolbar-h);
|
|
99
|
-
align-items: center;
|
|
100
|
-
background: var(--gbd-dt-surface);
|
|
101
|
-
border-bottom: 1px solid var(--gbd-dt-border);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/* 分组分隔线:canvas .menu-divider 口径(1×16 + #cfd2d8),覆盖 office.scss 的 1×18 + --gbd-dt-border */
|
|
105
|
-
.word-scope .word-toolbar .of-toolbar-sep {
|
|
106
|
-
height: 16px;
|
|
107
|
-
background: var(--gbd-dt-border-strong);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
80
|
/* ==================== 页内浮件 ==================== */
|
|
111
81
|
|
|
112
82
|
/* 特殊字符浮盘:吸在工具栏下沿右侧(工具栏行底 = 菜单栏 31 + 头部 35 + 工具条 37)
|
|
@@ -266,7 +236,8 @@
|
|
|
266
236
|
/* [设计] 纸永远白、纸面文字近黑:Word 画布走 Word 保真,不随主题令牌走(与 content.scss 的画布口径一致) */
|
|
267
237
|
.word-sheets {
|
|
268
238
|
position: absolute;
|
|
269
|
-
top
|
|
239
|
+
/* 屏幕态纸上沿留出画布留白(应用按 --gbd-wd-sheet-top 下发,打印态归零) */
|
|
240
|
+
top: var(--gbd-wd-sheet-top, 0px);
|
|
270
241
|
left: 50%;
|
|
271
242
|
z-index: 0;
|
|
272
243
|
transform: translateX(-50%);
|
|
@@ -278,7 +249,8 @@
|
|
|
278
249
|
right: 0;
|
|
279
250
|
left: 0;
|
|
280
251
|
background: #fff;
|
|
281
|
-
|
|
252
|
+
/* 1px 极浅描边定出纸上沿,外圈投影让纸浮在画布上(Word 口径) */
|
|
253
|
+
box-shadow: 0 0 0 1px rgb(23 26 31 / 7%), 0 2px 14px rgb(23 26 31 / 18%);
|
|
282
254
|
}
|
|
283
255
|
|
|
284
256
|
/* 页眉/页脚(受限富文本:双击带就地编辑,普通操作走页面设置对话框) */
|
|
@@ -388,26 +360,14 @@
|
|
|
388
360
|
--gbd-wd-gutter: 0px;
|
|
389
361
|
}
|
|
390
362
|
|
|
391
|
-
|
|
392
|
-
.word-scope .word-app .word-head,
|
|
393
|
-
.word-scope .word-app .word-toolbar,
|
|
394
|
-
.word-scope .word-app .word-statusbar,
|
|
395
|
-
.word-scope .word-app .word-toc,
|
|
396
|
-
.word-scope .word-app .word-cmt,
|
|
397
|
-
.word-scope .word-app .word-chars-pop {
|
|
398
|
-
display: none !important;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
.word-scope .word-app .word-main,
|
|
402
|
-
.word-scope .word-app .word-editor {
|
|
403
|
-
display: block;
|
|
404
|
-
background: #fff;
|
|
405
|
-
}
|
|
363
|
+
/* 界面件隐藏与主区摊平由 app.css 的打印块统一负责,这里只处理纸面几何 */
|
|
406
364
|
|
|
407
365
|
/* [坑] 屏幕缩放(页面行内挂在 .word-editor 的 zoom)与滚动容器都会毁掉出纸:
|
|
408
366
|
前者让内容超出纸宽裁掉,后者的 overflow:auto 只印可见那一屏,两者必须一并摊平 */
|
|
409
367
|
.word-scope .word-app .word-editor {
|
|
410
368
|
zoom: 1 !important;
|
|
369
|
+
/* 纸层顶部留白只属于屏幕画布:打印面纸贴纸,变量由应用行内下发,这里必须盖掉 */
|
|
370
|
+
--gbd-wd-sheet-top: 0px !important;
|
|
411
371
|
}
|
|
412
372
|
|
|
413
373
|
.word-scope .word-app .rich-edit-surface,
|