gbpptx 0.1.1 → 0.3.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 +220 -158
- package/package.json +15 -4
- package/src/index.js +16 -8
- package/src/kernel/model.js +397 -91
- package/src/kernel/parts.js +3 -3
- package/src/kernel/pptx.js +17 -12
- package/src/kernel/read.js +747 -157
- package/src/kernel/roundtrip.js +118 -18
- package/src/kernel/text.js +133 -28
- package/src/kernel/write.js +160 -49
- package/web/app/main.js +8 -8
- package/web/app/slides/arrange.js +101 -0
- package/web/app/slides/clipboard.js +93 -0
- package/web/app/slides/file.js +243 -0
- package/web/app/slides/find.js +199 -0
- package/web/app/slides/history.js +100 -0
- package/web/app/slides/keys.js +174 -0
- package/web/app/slides/menus.js +105 -0
- package/web/app/slides/objects.js +254 -0
- package/web/app/slides/render.js +183 -0
- package/web/app/slides/shared.js +85 -0
- package/web/app/slides/slides.js +103 -0
- package/web/app/slides/table.js +102 -0
- package/web/app/slides/text.js +418 -0
- package/web/app/slides/view.js +130 -0
- package/web/app/slides-app.js +285 -844
- package/web/app/ui/backstage.js +255 -0
- package/web/app/ui/canvas.js +762 -277
- package/web/app/ui/color-panel.js +58 -58
- package/web/app/ui/dialogs.js +120 -120
- package/web/app/ui/file-io.js +116 -89
- package/web/app/ui/format-pane.js +427 -0
- package/web/app/ui/icons.js +129 -0
- package/web/app/ui/menu.js +75 -105
- package/web/app/ui/notify.js +45 -45
- package/web/app/ui/page-view.js +221 -150
- package/web/app/ui/popup.js +80 -80
- package/web/app/ui/present.js +292 -100
- package/web/app/ui/ribbon.js +878 -0
- package/web/app/ui/slide-pane.js +189 -0
- package/web/app/ui/statusbar.js +93 -0
- package/web/app/ui/text-styles.js +84 -84
- package/web/app/ui/titlebar.js +208 -0
- package/web/app/ui/transition.js +30 -0
- package/web/index.html +23 -21
- package/web/serve.mjs +20 -67
- package/web/styles/office.css +642 -0
- package/web/styles/slides.css +210 -212
- package/web/styles/tokens.css +154 -155
- package/src/kernel/menus.js +0 -123
- package/src/kernel/util/escape.js +0 -21
- package/src/kernel/util/id.js +0 -13
- package/web/app/ui/inspector.js +0 -209
- package/web/app/ui/slides-bar.js +0 -63
- package/web/app/ui/toolbar.js +0 -200
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
// [文件] gbpptx·幻灯片窗格 —— 缩略图/大纲双视图、拖拽排序、页操作入口
|
|
2
|
+
|
|
3
|
+
import { SLIDE_LAYOUTS, TRANSITIONS, htmlToPlain } from '../../../src/kernel/model.js';
|
|
4
|
+
import { renderPage } from './page-view.js';
|
|
5
|
+
import { icon } from './icons.js';
|
|
6
|
+
import { openMenu } from './menu.js';
|
|
7
|
+
|
|
8
|
+
const THUMB_W = 164;
|
|
9
|
+
|
|
10
|
+
export class SlidePane {
|
|
11
|
+
constructor(app) {
|
|
12
|
+
this.app = app;
|
|
13
|
+
this.el = document.createElement('aside');
|
|
14
|
+
this.el.className = 'pp-slidepane';
|
|
15
|
+
this.el.innerHTML = `
|
|
16
|
+
<div class="pp-slidepane__tabs">
|
|
17
|
+
<button type="button" class="pp-slidepane__tab gbp-is-active" data-tab="slides">幻灯片</button>
|
|
18
|
+
<button type="button" class="pp-slidepane__tab" data-tab="outline">大纲</button>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="pp-slidepane__body">
|
|
21
|
+
<div class="pp-thumbs" data-view="slides"></div>
|
|
22
|
+
<div class="pp-outline" data-view="outline" hidden></div>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="pp-slidepane__foot">
|
|
25
|
+
<button type="button" class="pp-slidepane__new" data-act="new">${icon('newSlide', 18)}<span>新建幻灯片</span></button>
|
|
26
|
+
<button type="button" class="pp-slidepane__layout" data-act="layout" title="选择版式">${icon('chevronDown', 14)}</button>
|
|
27
|
+
</div>`;
|
|
28
|
+
this.thumbsEl = this.el.querySelector('.pp-thumbs');
|
|
29
|
+
this.outlineEl = this.el.querySelector('.pp-outline');
|
|
30
|
+
this.tabButtons = [...this.el.querySelectorAll('[data-tab]')];
|
|
31
|
+
this.view = 'slides';
|
|
32
|
+
this.bind();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
bind() {
|
|
36
|
+
for (const btn of this.tabButtons) {
|
|
37
|
+
btn.addEventListener('click', () => this.setView(btn.dataset.tab));
|
|
38
|
+
}
|
|
39
|
+
this.el.querySelector('[data-act="new"]').addEventListener('click', () => this.app.addSlide());
|
|
40
|
+
this.el.querySelector('[data-act="layout"]').addEventListener('click', (e) => {
|
|
41
|
+
openMenu({
|
|
42
|
+
anchor: e.currentTarget,
|
|
43
|
+
placement: 'top-end',
|
|
44
|
+
items: SLIDE_LAYOUTS.map((l) => ({ label: l.label, onClick: () => this.app.addSlide(l.key) })),
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
this.thumbsEl.addEventListener('click', (e) => {
|
|
48
|
+
const thumb = e.target.closest('.pp-thumb');
|
|
49
|
+
if (thumb) this.app.selectSlide(Number(thumb.dataset.index));
|
|
50
|
+
});
|
|
51
|
+
this.thumbsEl.addEventListener('dblclick', (e) => {
|
|
52
|
+
const thumb = e.target.closest('.pp-thumb');
|
|
53
|
+
if (thumb) this.app.presentAt(Number(thumb.dataset.index));
|
|
54
|
+
});
|
|
55
|
+
this.thumbsEl.addEventListener('contextmenu', (e) => {
|
|
56
|
+
const thumb = e.target.closest('.pp-thumb');
|
|
57
|
+
if (!thumb) return;
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
this.app.selectSlide(Number(thumb.dataset.index));
|
|
60
|
+
this.app.openSlideMenu(e.clientX, e.clientY, Number(thumb.dataset.index));
|
|
61
|
+
});
|
|
62
|
+
this.thumbsEl.addEventListener('dragstart', (e) => {
|
|
63
|
+
const thumb = e.target.closest('.pp-thumb');
|
|
64
|
+
if (!thumb) return;
|
|
65
|
+
this.dragIndex = Number(thumb.dataset.index);
|
|
66
|
+
thumb.classList.add('gbp-is-dragging');
|
|
67
|
+
e.dataTransfer.effectAllowed = 'move';
|
|
68
|
+
e.dataTransfer.setData('text/plain', String(this.dragIndex));
|
|
69
|
+
});
|
|
70
|
+
this.thumbsEl.addEventListener('dragend', () => {
|
|
71
|
+
this.dragIndex = null;
|
|
72
|
+
this.thumbsEl.querySelectorAll('.gbp-is-dragging, .gbp-is-drop').forEach((el) => el.classList.remove('gbp-is-dragging', 'gbp-is-drop'));
|
|
73
|
+
});
|
|
74
|
+
this.thumbsEl.addEventListener('dragover', (e) => {
|
|
75
|
+
const thumb = e.target.closest('.pp-thumb');
|
|
76
|
+
if (!thumb || this.dragIndex === null) return;
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
this.thumbsEl.querySelectorAll('.gbp-is-drop').forEach((el) => el.classList.remove('gbp-is-drop'));
|
|
79
|
+
thumb.classList.add('gbp-is-drop');
|
|
80
|
+
});
|
|
81
|
+
this.thumbsEl.addEventListener('drop', (e) => {
|
|
82
|
+
const thumb = e.target.closest('.pp-thumb');
|
|
83
|
+
if (!thumb || this.dragIndex === null) return;
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
const to = Number(thumb.dataset.index);
|
|
86
|
+
this.thumbsEl.querySelectorAll('.gbp-is-drop').forEach((el) => el.classList.remove('gbp-is-drop'));
|
|
87
|
+
if (to !== this.dragIndex) this.app.moveSlideTo(this.dragIndex, to);
|
|
88
|
+
this.dragIndex = null;
|
|
89
|
+
});
|
|
90
|
+
this.outlineEl.addEventListener('click', (e) => {
|
|
91
|
+
const line = e.target.closest('[data-slide]');
|
|
92
|
+
if (!line) return;
|
|
93
|
+
this.app.selectSlide(Number(line.dataset.slide));
|
|
94
|
+
if (line.dataset.obj) this.app.selectObjects([line.dataset.obj]);
|
|
95
|
+
});
|
|
96
|
+
this.outlineEl.addEventListener('dblclick', (e) => {
|
|
97
|
+
const line = e.target.closest('[data-slide]');
|
|
98
|
+
if (!line) return;
|
|
99
|
+
this.app.selectSlide(Number(line.dataset.slide));
|
|
100
|
+
if (line.dataset.obj) this.app.startEditingById(line.dataset.obj);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
setView(view) {
|
|
105
|
+
this.view = view;
|
|
106
|
+
for (const btn of this.tabButtons) btn.classList.toggle('gbp-is-active', btn.dataset.tab === view);
|
|
107
|
+
this.el.querySelector('.pp-thumbs').hidden = view !== 'slides';
|
|
108
|
+
this.el.querySelector('.pp-outline').hidden = view !== 'outline';
|
|
109
|
+
if (view === 'outline') this.renderOutline();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
render() {
|
|
113
|
+
this.renderThumbs();
|
|
114
|
+
if (this.view === 'outline') this.renderOutline();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
renderThumbs() {
|
|
118
|
+
const { slides } = this.app.snapshot;
|
|
119
|
+
const theme = this.app.snapshot.theme;
|
|
120
|
+
const size = this.app.size;
|
|
121
|
+
this.thumbsEl.replaceChildren();
|
|
122
|
+
slides.forEach((slide, i) => {
|
|
123
|
+
const thumb = document.createElement('div');
|
|
124
|
+
thumb.className = `pp-thumb${i === this.app.index ? ' gbp-is-active' : ''}${slide.hidden ? ' gbp-is-hidden' : ''}`;
|
|
125
|
+
thumb.dataset.index = String(i);
|
|
126
|
+
thumb.draggable = true;
|
|
127
|
+
const no = document.createElement('div');
|
|
128
|
+
no.className = 'pp-thumb__no';
|
|
129
|
+
no.textContent = String(i + 1);
|
|
130
|
+
const box = document.createElement('div');
|
|
131
|
+
box.className = 'pp-thumb__box';
|
|
132
|
+
box.style.paddingBottom = `${(size.h / size.w) * 100}%`;
|
|
133
|
+
const page = renderPage(slide, theme, { size });
|
|
134
|
+
page.style.transform = `scale(${THUMB_W / size.w})`;
|
|
135
|
+
box.appendChild(page);
|
|
136
|
+
thumb.append(no, box);
|
|
137
|
+
if (slide.hidden) {
|
|
138
|
+
const flag = document.createElement('span');
|
|
139
|
+
flag.className = 'pp-thumb__flag pp-thumb__flag--hidden';
|
|
140
|
+
flag.innerHTML = icon('hide', 13);
|
|
141
|
+
thumb.appendChild(flag);
|
|
142
|
+
}
|
|
143
|
+
const tr = slide.transition || {};
|
|
144
|
+
if (tr.type && tr.type !== 'none') {
|
|
145
|
+
const flag = document.createElement('span');
|
|
146
|
+
flag.className = 'pp-thumb__flag pp-thumb__flag--transition';
|
|
147
|
+
flag.innerHTML = icon('transition', 13);
|
|
148
|
+
flag.title = `切换:${TRANSITIONS.find((t) => t.key === tr.type)?.label || tr.type}`;
|
|
149
|
+
thumb.appendChild(flag);
|
|
150
|
+
}
|
|
151
|
+
this.thumbsEl.appendChild(thumb);
|
|
152
|
+
});
|
|
153
|
+
this.scrollToActive();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
renderOutline() {
|
|
157
|
+
const { slides } = this.app.snapshot;
|
|
158
|
+
this.outlineEl.replaceChildren();
|
|
159
|
+
slides.forEach((slide, si) => {
|
|
160
|
+
const row = document.createElement('div');
|
|
161
|
+
row.className = 'pp-outline__slide';
|
|
162
|
+
const no = document.createElement('span');
|
|
163
|
+
no.className = 'pp-outline__no';
|
|
164
|
+
no.textContent = String(si + 1);
|
|
165
|
+
row.appendChild(no);
|
|
166
|
+
const texts = slide.objects.filter((o) => o.type === 'text');
|
|
167
|
+
if (texts.length === 0) {
|
|
168
|
+
const empty = document.createElement('span');
|
|
169
|
+
empty.className = 'pp-outline__empty';
|
|
170
|
+
empty.textContent = '(空白页)';
|
|
171
|
+
empty.dataset.slide = String(si);
|
|
172
|
+
row.appendChild(empty);
|
|
173
|
+
}
|
|
174
|
+
texts.forEach((o, ti) => {
|
|
175
|
+
const line = document.createElement('span');
|
|
176
|
+
line.className = `pp-outline__line${ti === 0 ? ' gbp-is-title' : ''}`;
|
|
177
|
+
line.dataset.slide = String(si);
|
|
178
|
+
line.dataset.obj = o.id;
|
|
179
|
+
line.textContent = htmlToPlain(o.props.html).replace(/\n+/g, ' / ') || '(空文本框)';
|
|
180
|
+
row.appendChild(line);
|
|
181
|
+
});
|
|
182
|
+
this.outlineEl.appendChild(row);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
scrollToActive() {
|
|
187
|
+
this.thumbsEl.querySelector('.pp-thumb.gbp-is-active')?.scrollIntoView({ block: 'nearest' });
|
|
188
|
+
}
|
|
189
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// [文件] gbpptx·状态栏 —— 页数/语言/备注 + 视图切换 + 缩放滑块(Office 式)
|
|
2
|
+
|
|
3
|
+
import { icon } from './icons.js';
|
|
4
|
+
import { openMenu } from './menu.js';
|
|
5
|
+
|
|
6
|
+
const el = (tag, cls, text) => {
|
|
7
|
+
const node = document.createElement(tag);
|
|
8
|
+
if (cls) node.className = cls;
|
|
9
|
+
if (text != null) node.textContent = text;
|
|
10
|
+
return node;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export class StatusBar {
|
|
14
|
+
constructor(app) {
|
|
15
|
+
this.app = app;
|
|
16
|
+
this.el = el('footer', 'pp-statusbar');
|
|
17
|
+
this.build();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
build() {
|
|
21
|
+
const left = el('div', 'pp-statusbar__left');
|
|
22
|
+
this.infoEl = el('span', 'pp-statusbar__text');
|
|
23
|
+
this.statusEl = el('span', 'pp-statusbar__status');
|
|
24
|
+
const lang = el('span', 'pp-statusbar__text', '中文(中国)');
|
|
25
|
+
this.notesBtn = el('button', 'pp-statusbar__btn', '备注');
|
|
26
|
+
this.notesBtn.type = 'button';
|
|
27
|
+
this.notesBtn.addEventListener('click', () => this.app.toggleNotes());
|
|
28
|
+
left.append(this.infoEl, lang, this.statusEl, this.notesBtn);
|
|
29
|
+
|
|
30
|
+
const right = el('div', 'pp-statusbar__right');
|
|
31
|
+
const views = el('div', 'pp-statusbar__views');
|
|
32
|
+
this.viewButtons = {};
|
|
33
|
+
for (const [key, iconName, title] of [
|
|
34
|
+
['normal', 'viewNormal', '普通视图'],
|
|
35
|
+
['sorter', 'viewSorter', '幻灯片浏览'],
|
|
36
|
+
['reading', 'viewReading', '阅读视图'],
|
|
37
|
+
]) {
|
|
38
|
+
const b = el('button', 'pp-statusbar__view');
|
|
39
|
+
b.type = 'button';
|
|
40
|
+
b.title = title;
|
|
41
|
+
b.innerHTML = icon(iconName, 16);
|
|
42
|
+
b.addEventListener('click', () => this.app.setView(key));
|
|
43
|
+
this.viewButtons[key] = b;
|
|
44
|
+
views.appendChild(b);
|
|
45
|
+
}
|
|
46
|
+
const zoomOut = el('button', 'pp-statusbar__zoombtn');
|
|
47
|
+
zoomOut.type = 'button';
|
|
48
|
+
zoomOut.title = '缩小';
|
|
49
|
+
zoomOut.innerHTML = icon('minus', 14);
|
|
50
|
+
zoomOut.addEventListener('click', () => this.app.setZoom(this.app.zoom - 10));
|
|
51
|
+
this.slider = el('input', 'pp-statusbar__slider');
|
|
52
|
+
this.slider.type = 'range';
|
|
53
|
+
this.slider.min = '20';
|
|
54
|
+
this.slider.max = '400';
|
|
55
|
+
this.slider.step = '5';
|
|
56
|
+
this.slider.addEventListener('input', () => this.app.setZoom(Number(this.slider.value), { fromSlider: true }));
|
|
57
|
+
const zoomIn = el('button', 'pp-statusbar__zoombtn');
|
|
58
|
+
zoomIn.type = 'button';
|
|
59
|
+
zoomIn.title = '放大';
|
|
60
|
+
zoomIn.innerHTML = icon('plus', 14);
|
|
61
|
+
zoomIn.addEventListener('click', () => this.app.setZoom(this.app.zoom + 10));
|
|
62
|
+
this.zoomText = el('button', 'pp-statusbar__zoomtext', '100%');
|
|
63
|
+
this.zoomText.type = 'button';
|
|
64
|
+
this.zoomText.title = '缩放';
|
|
65
|
+
this.zoomText.addEventListener('click', () => openMenu({
|
|
66
|
+
anchor: this.zoomText,
|
|
67
|
+
placement: 'top-end',
|
|
68
|
+
items: [50, 75, 100, 125, 150, 200, 400].map((z) => ({ label: `${z}%`, checked: this.app.zoom === z, onClick: () => this.app.setZoom(z) }))
|
|
69
|
+
.concat([{ divided: true }, { label: '适应窗口', onClick: () => this.app.fitToWindow() }]),
|
|
70
|
+
}));
|
|
71
|
+
const fit = el('button', 'pp-statusbar__zoombtn');
|
|
72
|
+
fit.type = 'button';
|
|
73
|
+
fit.title = '适应窗口';
|
|
74
|
+
fit.innerHTML = icon('fitWindow', 15);
|
|
75
|
+
fit.addEventListener('click', () => this.app.fitToWindow());
|
|
76
|
+
right.append(views, zoomOut, this.slider, zoomIn, this.zoomText, fit);
|
|
77
|
+
|
|
78
|
+
this.el.append(left, right);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
refresh() {
|
|
82
|
+
const app = this.app;
|
|
83
|
+
this.infoEl.textContent = `幻灯片 ${app.index + 1} / ${app.snapshot.slides.length}`;
|
|
84
|
+
this.notesBtn.classList.toggle('gbp-is-active', app.notesVisible);
|
|
85
|
+
for (const [key, b] of Object.entries(this.viewButtons)) b.classList.toggle('gbp-is-active', app.view === key);
|
|
86
|
+
this.zoomText.textContent = `${app.zoom}%`;
|
|
87
|
+
if (document.activeElement !== this.slider) this.slider.value = String(app.zoom);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
setStatus(text) {
|
|
91
|
+
this.statusEl.textContent = text || '';
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
// [文件] web·core·文字样式常量 —— 字号/字体/调色板/对齐/字体效果/组合色的单一来源(富文本编辑器与演示文稿工具条共用,禁各域再建第二张表)
|
|
2
|
-
// [通用:常量] textStyles —— FONT_SIZES / FONT_FAMILIES / TEXT_COLORS / BG_COLORS / ALIGN_OPTIONS / FONT_EFFECTS / COMBO_STYLES / RECENT_STYLE_LIMIT
|
|
3
|
-
|
|
4
|
-
/** 字号预设(px,12~72) */
|
|
5
|
-
export const FONT_SIZES = [12, 13, 14, 15, 16, 18, 20, 24, 28, 32, 36, 42, 48, 54, 62, 72];
|
|
6
|
-
|
|
7
|
-
/** 字体(系统字体 + Web 安全字体;内网不回源加载,命中本机字体即生效) */
|
|
8
|
-
export const FONT_FAMILIES = [
|
|
9
|
-
{ label: '微软雅黑', value: 'Microsoft YaHei, "微软雅黑"' },
|
|
10
|
-
{ label: '苹方', value: 'PingFang SC, "苹方-简"' },
|
|
11
|
-
{ label: '宋体', value: 'SimSun, "宋体", serif' },
|
|
12
|
-
{ label: '黑体', value: 'SimHei, "黑体", sans-serif' },
|
|
13
|
-
{ label: '楷体', value: 'KaiTi, "楷体", serif' },
|
|
14
|
-
{ label: '仿宋', value: 'FangSong, "仿宋", serif' },
|
|
15
|
-
{ label: '思源黑体', value: '"Noto Sans SC", "Source Han Sans SC", sans-serif' },
|
|
16
|
-
{ label: '思源宋体', value: '"Noto Serif SC", "Source Han Serif SC", serif' },
|
|
17
|
-
{ label: 'Arial', value: 'Arial, Helvetica, sans-serif' },
|
|
18
|
-
{ label: 'Helvetica', value: '"Helvetica Neue", Helvetica, sans-serif' },
|
|
19
|
-
{ label: 'Inter', value: 'Inter, -apple-system, sans-serif' },
|
|
20
|
-
{ label: 'Roboto', value: 'Roboto, "Segoe UI", sans-serif' },
|
|
21
|
-
{ label: 'Times New Roman', value: '"Times New Roman", Times, serif' },
|
|
22
|
-
{ label: 'Georgia', value: 'Georgia, "Times New Roman", serif' },
|
|
23
|
-
{ label: 'Courier New', value: '"Courier New", Courier, monospace' },
|
|
24
|
-
{ label: 'Consolas', value: 'Consolas, "Courier New", monospace' },
|
|
25
|
-
{ label: 'Monaco', value: 'Monaco, Consolas, monospace' },
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
/** 对齐方式(互斥高亮) */
|
|
29
|
-
export const ALIGN_OPTIONS = [
|
|
30
|
-
{ value: 'left', title: '左对齐', icon: 'alignLeft' },
|
|
31
|
-
{ value: 'center', title: '居中', icon: 'alignCenter' },
|
|
32
|
-
{ value: 'right', title: '右对齐', icon: 'alignRight' },
|
|
33
|
-
{ value: 'justify', title: '两端对齐', icon: 'alignJustify' },
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
/** 文字色调色板(淡→深,两行:灰阶 + 彩色) */
|
|
37
|
-
export const TEXT_COLORS = [
|
|
38
|
-
'#000000', '#434343', '#666666', '#999999', '#b7b7b7', '#cccccc', '#d9d9d9', '#efefef', '#f3f3f3', '#ffffff',
|
|
39
|
-
'#980000', '#ff0000', '#ff9900', '#bf9000', '#38761d', '#00ff00', '#00ffff', '#4a86e8', '#0000ff', '#9900ff',
|
|
40
|
-
'#cc4125', '#e06666', '#f6b26b', '#ffd966', '#93c47d', '#76a5af', '#6d9eeb', '#8e7cc3', '#c27ba0', '#ff00ff',
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
/** 背景色(高亮)调色板:每组由浅到深,共 6 列 */
|
|
44
|
-
export const BG_COLORS = [
|
|
45
|
-
'#ffffff', '#f2f3f5', '#e7e9eb', '#d4d5d9', '#c9c7c6', '#a8adb3',
|
|
46
|
-
'#fde9e9', '#fddede', '#ffd4d4', '#fbc1c1', '#f8b0b0', '#f5a3a3',
|
|
47
|
-
'#fff3d6', '#ffe9b3', '#ffdf8f', '#ffd25e', '#ffc233', '#ffb500',
|
|
48
|
-
'#fffbd0', '#fdf2bc', '#fbea93', '#f8e35e', '#f5dc33', '#f5d500',
|
|
49
|
-
'#e8fad4', '#d3f2b3', '#b9ec8e', '#a5e266', '#8fd354', '#71b823',
|
|
50
|
-
'#d6f5f5', '#b3e9e9', '#8fdcdc', '#66cccc', '#4db8b8', '#339999',
|
|
51
|
-
'#dae8fc', '#d0e4f7', '#b4d6f5', '#9cc2f0', '#7db3ea', '#5698e0',
|
|
52
|
-
];
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* 字体效果(互斥布尔样式;key 即内核标记键,value 是落到内联 style 的 CSS 值)
|
|
56
|
-
* 空心 = -webkit-text-stroke 描边 + 透明填充;阴影 = 多层 text-shadow。
|
|
57
|
-
*/
|
|
58
|
-
export const FONT_EFFECTS = [
|
|
59
|
-
{
|
|
60
|
-
key: 'textStroke',
|
|
61
|
-
label: '空心',
|
|
62
|
-
value: '0.2px currentColor',
|
|
63
|
-
preview: { WebkitTextStroke: '0.2px currentColor', WebkitTextFillColor: 'transparent' },
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
key: 'textShadow',
|
|
67
|
-
label: '阴影',
|
|
68
|
-
value: '1px 1px var(--dt-border-strong), 2px 2px var(--dt-border-strong)',
|
|
69
|
-
preview: { textShadow: '1px 1px var(--dt-border-strong), 2px 2px var(--dt-border-strong)' },
|
|
70
|
-
},
|
|
71
|
-
];
|
|
72
|
-
|
|
73
|
-
/** 组合色(前景 + 背景一体应用);取值同调色板的 hex */
|
|
74
|
-
export const COMBO_STYLES = [
|
|
75
|
-
{ color: '#000000', backgroundColor: '#fde9e9' },
|
|
76
|
-
{ color: '#980000', backgroundColor: '#ffd4d4' },
|
|
77
|
-
{ color: '#bf9000', backgroundColor: '#fff3d6' },
|
|
78
|
-
{ color: '#38761d', backgroundColor: '#e8fad4' },
|
|
79
|
-
{ color: '#4a86e8', backgroundColor: '#dae8fc' },
|
|
80
|
-
{ color: '#9900ff', backgroundColor: '#e7e9eb' },
|
|
81
|
-
];
|
|
82
|
-
|
|
83
|
-
/** 「最近使用的外观」保留条数 */
|
|
84
|
-
export const RECENT_STYLE_LIMIT = 14;
|
|
1
|
+
// [文件] web·core·文字样式常量 —— 字号/字体/调色板/对齐/字体效果/组合色的单一来源(富文本编辑器与演示文稿工具条共用,禁各域再建第二张表)
|
|
2
|
+
// [通用:常量] textStyles —— FONT_SIZES / FONT_FAMILIES / TEXT_COLORS / BG_COLORS / ALIGN_OPTIONS / FONT_EFFECTS / COMBO_STYLES / RECENT_STYLE_LIMIT
|
|
3
|
+
|
|
4
|
+
/** 字号预设(px,12~72) */
|
|
5
|
+
export const FONT_SIZES = [12, 13, 14, 15, 16, 18, 20, 24, 28, 32, 36, 42, 48, 54, 62, 72];
|
|
6
|
+
|
|
7
|
+
/** 字体(系统字体 + Web 安全字体;内网不回源加载,命中本机字体即生效) */
|
|
8
|
+
export const FONT_FAMILIES = [
|
|
9
|
+
{ label: '微软雅黑', value: 'Microsoft YaHei, "微软雅黑"' },
|
|
10
|
+
{ label: '苹方', value: 'PingFang SC, "苹方-简"' },
|
|
11
|
+
{ label: '宋体', value: 'SimSun, "宋体", serif' },
|
|
12
|
+
{ label: '黑体', value: 'SimHei, "黑体", sans-serif' },
|
|
13
|
+
{ label: '楷体', value: 'KaiTi, "楷体", serif' },
|
|
14
|
+
{ label: '仿宋', value: 'FangSong, "仿宋", serif' },
|
|
15
|
+
{ label: '思源黑体', value: '"Noto Sans SC", "Source Han Sans SC", sans-serif' },
|
|
16
|
+
{ label: '思源宋体', value: '"Noto Serif SC", "Source Han Serif SC", serif' },
|
|
17
|
+
{ label: 'Arial', value: 'Arial, Helvetica, sans-serif' },
|
|
18
|
+
{ label: 'Helvetica', value: '"Helvetica Neue", Helvetica, sans-serif' },
|
|
19
|
+
{ label: 'Inter', value: 'Inter, -apple-system, sans-serif' },
|
|
20
|
+
{ label: 'Roboto', value: 'Roboto, "Segoe UI", sans-serif' },
|
|
21
|
+
{ label: 'Times New Roman', value: '"Times New Roman", Times, serif' },
|
|
22
|
+
{ label: 'Georgia', value: 'Georgia, "Times New Roman", serif' },
|
|
23
|
+
{ label: 'Courier New', value: '"Courier New", Courier, monospace' },
|
|
24
|
+
{ label: 'Consolas', value: 'Consolas, "Courier New", monospace' },
|
|
25
|
+
{ label: 'Monaco', value: 'Monaco, Consolas, monospace' },
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
/** 对齐方式(互斥高亮) */
|
|
29
|
+
export const ALIGN_OPTIONS = [
|
|
30
|
+
{ value: 'left', title: '左对齐', icon: 'alignLeft' },
|
|
31
|
+
{ value: 'center', title: '居中', icon: 'alignCenter' },
|
|
32
|
+
{ value: 'right', title: '右对齐', icon: 'alignRight' },
|
|
33
|
+
{ value: 'justify', title: '两端对齐', icon: 'alignJustify' },
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
/** 文字色调色板(淡→深,两行:灰阶 + 彩色) */
|
|
37
|
+
export const TEXT_COLORS = [
|
|
38
|
+
'#000000', '#434343', '#666666', '#999999', '#b7b7b7', '#cccccc', '#d9d9d9', '#efefef', '#f3f3f3', '#ffffff',
|
|
39
|
+
'#980000', '#ff0000', '#ff9900', '#bf9000', '#38761d', '#00ff00', '#00ffff', '#4a86e8', '#0000ff', '#9900ff',
|
|
40
|
+
'#cc4125', '#e06666', '#f6b26b', '#ffd966', '#93c47d', '#76a5af', '#6d9eeb', '#8e7cc3', '#c27ba0', '#ff00ff',
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
/** 背景色(高亮)调色板:每组由浅到深,共 6 列 */
|
|
44
|
+
export const BG_COLORS = [
|
|
45
|
+
'#ffffff', '#f2f3f5', '#e7e9eb', '#d4d5d9', '#c9c7c6', '#a8adb3',
|
|
46
|
+
'#fde9e9', '#fddede', '#ffd4d4', '#fbc1c1', '#f8b0b0', '#f5a3a3',
|
|
47
|
+
'#fff3d6', '#ffe9b3', '#ffdf8f', '#ffd25e', '#ffc233', '#ffb500',
|
|
48
|
+
'#fffbd0', '#fdf2bc', '#fbea93', '#f8e35e', '#f5dc33', '#f5d500',
|
|
49
|
+
'#e8fad4', '#d3f2b3', '#b9ec8e', '#a5e266', '#8fd354', '#71b823',
|
|
50
|
+
'#d6f5f5', '#b3e9e9', '#8fdcdc', '#66cccc', '#4db8b8', '#339999',
|
|
51
|
+
'#dae8fc', '#d0e4f7', '#b4d6f5', '#9cc2f0', '#7db3ea', '#5698e0',
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 字体效果(互斥布尔样式;key 即内核标记键,value 是落到内联 style 的 CSS 值)
|
|
56
|
+
* 空心 = -webkit-text-stroke 描边 + 透明填充;阴影 = 多层 text-shadow。
|
|
57
|
+
*/
|
|
58
|
+
export const FONT_EFFECTS = [
|
|
59
|
+
{
|
|
60
|
+
key: 'textStroke',
|
|
61
|
+
label: '空心',
|
|
62
|
+
value: '0.2px currentColor',
|
|
63
|
+
preview: { WebkitTextStroke: '0.2px currentColor', WebkitTextFillColor: 'transparent' },
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: 'textShadow',
|
|
67
|
+
label: '阴影',
|
|
68
|
+
value: '1px 1px var(--gbp-dt-border-strong), 2px 2px var(--gbp-dt-border-strong)',
|
|
69
|
+
preview: { textShadow: '1px 1px var(--gbp-dt-border-strong), 2px 2px var(--gbp-dt-border-strong)' },
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
/** 组合色(前景 + 背景一体应用);取值同调色板的 hex */
|
|
74
|
+
export const COMBO_STYLES = [
|
|
75
|
+
{ color: '#000000', backgroundColor: '#fde9e9' },
|
|
76
|
+
{ color: '#980000', backgroundColor: '#ffd4d4' },
|
|
77
|
+
{ color: '#bf9000', backgroundColor: '#fff3d6' },
|
|
78
|
+
{ color: '#38761d', backgroundColor: '#e8fad4' },
|
|
79
|
+
{ color: '#4a86e8', backgroundColor: '#dae8fc' },
|
|
80
|
+
{ color: '#9900ff', backgroundColor: '#e7e9eb' },
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
/** 「最近使用的外观」保留条数 */
|
|
84
|
+
export const RECENT_STYLE_LIMIT = 14;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// [文件] gbpptx·顶部菜单栏 —— 与 gbdocs / gbxlxs 一致:左侧菜单栏 + 右侧文档名/保存状态/保存按钮
|
|
2
|
+
|
|
3
|
+
import { SHAPE_KINDS, SLIDE_LAYOUTS, TRANSITIONS } from '../../../src/kernel/model.js';
|
|
4
|
+
import { icon } from './icons.js';
|
|
5
|
+
import { openMenu } from './menu.js';
|
|
6
|
+
import { openModal } from './dialogs.js';
|
|
7
|
+
|
|
8
|
+
const el = (tag, cls, text) => {
|
|
9
|
+
const node = document.createElement(tag);
|
|
10
|
+
if (cls) node.className = cls;
|
|
11
|
+
if (text != null) node.textContent = text;
|
|
12
|
+
return node;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const submenu = (label, items) => ({ label, children: items });
|
|
16
|
+
|
|
17
|
+
export class TitleBar {
|
|
18
|
+
constructor(app) {
|
|
19
|
+
this.app = app;
|
|
20
|
+
this.el = el('header', 'pp-topbar');
|
|
21
|
+
this.build();
|
|
22
|
+
this.refresh();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
build() {
|
|
26
|
+
const defs = [
|
|
27
|
+
['文件', () => this.fileItems()],
|
|
28
|
+
['编辑', () => this.editItems()],
|
|
29
|
+
['插入', () => this.insertItems()],
|
|
30
|
+
['幻灯片', () => this.slideItems()],
|
|
31
|
+
['放映', () => this.showItems()],
|
|
32
|
+
['审阅', () => this.reviewItems()],
|
|
33
|
+
['视图', () => this.viewItems()],
|
|
34
|
+
];
|
|
35
|
+
const bar = el('div', 'pp-menubar');
|
|
36
|
+
for (const [label, items] of defs) {
|
|
37
|
+
const btn = el('button', 'pp-menubar__btn', label);
|
|
38
|
+
btn.type = 'button';
|
|
39
|
+
btn.addEventListener('click', () => {
|
|
40
|
+
btn.classList.add('gbp-is-open');
|
|
41
|
+
openMenu({ anchor: btn, items: items(), onClose: () => btn.classList.remove('gbp-is-open') });
|
|
42
|
+
});
|
|
43
|
+
bar.appendChild(btn);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const info = el('div', 'pp-docinfo');
|
|
47
|
+
this.nameEl = el('span', 'pp-docinfo__name', '新建演示');
|
|
48
|
+
this.stateEl = el('span', 'pp-docinfo__state', '已保存');
|
|
49
|
+
this.saveBtn = el('button', 'pp-docinfo__save', '保存');
|
|
50
|
+
this.saveBtn.type = 'button';
|
|
51
|
+
this.saveBtn.title = '保存 (Ctrl+S)';
|
|
52
|
+
this.saveBtn.addEventListener('click', () => this.app.save());
|
|
53
|
+
info.append(this.nameEl, this.stateEl, this.saveBtn);
|
|
54
|
+
|
|
55
|
+
this.el.append(bar, info);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* ===================== 菜单条目 ===================== */
|
|
59
|
+
|
|
60
|
+
fileItems() {
|
|
61
|
+
const app = this.app;
|
|
62
|
+
const hasSlides = app.snapshot.slides.length > 0;
|
|
63
|
+
return [
|
|
64
|
+
{ label: '新建', shortcut: 'Ctrl+N', onClick: () => app.newDoc() },
|
|
65
|
+
{ label: '打开…', shortcut: 'Ctrl+O', onClick: () => app.openFile() },
|
|
66
|
+
{ divided: true },
|
|
67
|
+
{ label: '保存', shortcut: 'Ctrl+S', disabled: !hasSlides, onClick: () => app.save() },
|
|
68
|
+
{ label: '另存为…', shortcut: 'Ctrl+Shift+S', disabled: !hasSlides, onClick: () => app.saveAs(app.doc.name) },
|
|
69
|
+
{ label: '自动保存', checked: app.autosave, onClick: () => app.setAutosave(!app.autosave) },
|
|
70
|
+
{ divided: true },
|
|
71
|
+
{ label: '导出 PPTX', disabled: !hasSlides, onClick: () => app.exportPptx() },
|
|
72
|
+
{ label: '导出 PDF', disabled: !hasSlides, onClick: () => app.exportPdf() },
|
|
73
|
+
{ label: '打印…', disabled: !hasSlides, onClick: () => app.exportPdf() },
|
|
74
|
+
{ divided: true },
|
|
75
|
+
{ label: '关闭', onClick: () => app.closeDocument() },
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
editItems() {
|
|
80
|
+
const app = this.app;
|
|
81
|
+
const hasSel = app.selectedIds.length > 0 || Boolean(app.editing);
|
|
82
|
+
return [
|
|
83
|
+
{ label: '撤销', shortcut: 'Ctrl+Z', disabled: !app.canUndo(), onClick: () => app.undo() },
|
|
84
|
+
{ label: '重做', shortcut: 'Ctrl+Y', disabled: !app.canRedo(), onClick: () => app.redo() },
|
|
85
|
+
{ divided: true },
|
|
86
|
+
{ label: '剪切', shortcut: 'Ctrl+X', disabled: !hasSel, onClick: () => app.cutSelected() },
|
|
87
|
+
{ label: '复制', shortcut: 'Ctrl+C', disabled: !hasSel, onClick: () => app.copySelected() },
|
|
88
|
+
{ label: '粘贴', shortcut: 'Ctrl+V', disabled: !app.canPaste(), onClick: () => app.paste() },
|
|
89
|
+
{ label: '粘贴为纯文本', onClick: () => app.pastePlain() },
|
|
90
|
+
{ divided: true },
|
|
91
|
+
{ label: '全选', shortcut: 'Ctrl+A', onClick: () => app.selectAll() },
|
|
92
|
+
{ label: '查找…', shortcut: 'Ctrl+F', onClick: () => app.openFind(false) },
|
|
93
|
+
{ label: '替换…', shortcut: 'Ctrl+H', onClick: () => app.openFind(true) },
|
|
94
|
+
];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
insertItems() {
|
|
98
|
+
const app = this.app;
|
|
99
|
+
return [
|
|
100
|
+
{ label: '新建幻灯片', shortcut: 'Ctrl+M', onClick: () => app.addSlide() },
|
|
101
|
+
{ divided: true },
|
|
102
|
+
submenu('表格', [2, 3, 4, 5].map((n) => ({
|
|
103
|
+
label: `${n}×${n} 表格`,
|
|
104
|
+
onClick: () => app.insertTable(n, n),
|
|
105
|
+
}))),
|
|
106
|
+
{ label: '图片…', onClick: () => app.insert('image') },
|
|
107
|
+
submenu('形状', SHAPE_KINDS.map((s) => ({
|
|
108
|
+
label: s.label,
|
|
109
|
+
onClick: () => app.insert('shape', s.kind),
|
|
110
|
+
}))),
|
|
111
|
+
{ label: '文本框', onClick: () => app.insert('text') },
|
|
112
|
+
{ label: '线条', onClick: () => app.insert('line') },
|
|
113
|
+
{ label: '箭头', onClick: () => app.insert('arrow') },
|
|
114
|
+
{ divided: true },
|
|
115
|
+
{ label: '备注', checked: app.notesVisible, onClick: () => app.toggleNotes() },
|
|
116
|
+
];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
slideItems() {
|
|
120
|
+
const app = this.app;
|
|
121
|
+
const count = app.snapshot.slides.length;
|
|
122
|
+
return [
|
|
123
|
+
{ label: '新建幻灯片', shortcut: 'Ctrl+M', onClick: () => app.addSlide() },
|
|
124
|
+
{ label: '复制幻灯片', onClick: () => app.dupSlide() },
|
|
125
|
+
{ label: '删除幻灯片', disabled: count <= 1, onClick: () => app.delSlide() },
|
|
126
|
+
{ divided: true },
|
|
127
|
+
{ label: '隐藏幻灯片', checked: Boolean(app.currentSlide()?.hidden), onClick: () => app.toggleSlideHidden() },
|
|
128
|
+
submenu('版式', SLIDE_LAYOUTS.map((l) => ({
|
|
129
|
+
label: l.label,
|
|
130
|
+
onClick: () => app.addSlide(l.key),
|
|
131
|
+
}))),
|
|
132
|
+
submenu('切换', TRANSITIONS.map((t) => ({
|
|
133
|
+
label: t.label,
|
|
134
|
+
onClick: () => app.setTransition({ type: t.key, dir: t.dir || 'l' }),
|
|
135
|
+
}))),
|
|
136
|
+
{ divided: true },
|
|
137
|
+
{ label: '重设位置与大小', disabled: !app.selectedIds.length, onClick: () => app.resetSelected() },
|
|
138
|
+
{ label: '设置背景格式…', onClick: () => app.openFormatPane() },
|
|
139
|
+
];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
showItems() {
|
|
143
|
+
const app = this.app;
|
|
144
|
+
return [
|
|
145
|
+
{ label: '从头开始', shortcut: 'F5', onClick: () => app.presentFromStart() },
|
|
146
|
+
{ label: '从当前页', shortcut: 'Shift+F5', onClick: () => app.presentFromCurrent() },
|
|
147
|
+
{ divided: true },
|
|
148
|
+
{ label: '演讲者视图', checked: app.presentOptions.presenter, onClick: () => app.togglePresenter() },
|
|
149
|
+
{ label: '循环放映', checked: app.presentOptions.loop, onClick: () => app.toggleLoop() },
|
|
150
|
+
{ label: '隐藏幻灯片', checked: Boolean(app.currentSlide()?.hidden), onClick: () => app.toggleSlideHidden() },
|
|
151
|
+
];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
reviewItems() {
|
|
155
|
+
const app = this.app;
|
|
156
|
+
return [
|
|
157
|
+
{ label: '显示备注', checked: app.notesVisible, onClick: () => app.toggleNotes() },
|
|
158
|
+
{ label: '字数统计…', onClick: () => app.showWordCount() },
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
viewItems() {
|
|
163
|
+
const app = this.app;
|
|
164
|
+
return [
|
|
165
|
+
{ label: '普通', checked: app.view === 'normal', onClick: () => app.setView('normal') },
|
|
166
|
+
{ label: '幻灯片浏览', checked: app.view === 'sorter', onClick: () => app.setView('sorter') },
|
|
167
|
+
{ label: '阅读视图', checked: app.view === 'reading', onClick: () => app.setView('reading') },
|
|
168
|
+
{ divided: true },
|
|
169
|
+
{ label: '网格线', checked: app.gridVisible, onClick: () => app.toggleGrid() },
|
|
170
|
+
{ label: '参考线', checked: app.guidesVisible, onClick: () => app.toggleGuides() },
|
|
171
|
+
{ label: '备注', checked: app.notesVisible, onClick: () => app.toggleNotes() },
|
|
172
|
+
{ label: '设置形状格式窗格', checked: app.formatPaneOpen, onClick: () => app.toggleFormatPane() },
|
|
173
|
+
{ divided: true },
|
|
174
|
+
{ label: '适应窗口', onClick: () => app.fitToWindow() },
|
|
175
|
+
{ label: '放大', shortcut: 'Ctrl+=', onClick: () => app.setZoom(app.zoom + 10) },
|
|
176
|
+
{ label: '缩小', shortcut: 'Ctrl+-', onClick: () => app.setZoom(app.zoom - 10) },
|
|
177
|
+
{ divided: true },
|
|
178
|
+
{ label: '关于挂逼演示…', onClick: () => this.showAbout() },
|
|
179
|
+
];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
showAbout() {
|
|
183
|
+
openModal({
|
|
184
|
+
title: '关于',
|
|
185
|
+
width: 400,
|
|
186
|
+
confirmText: '知道了',
|
|
187
|
+
build: (body) => {
|
|
188
|
+
const p = el('div', 'pp-about');
|
|
189
|
+
p.innerHTML = `${icon('logo', 40)}<h3>挂逼演示 gbpptx</h3><p>真实的 .pptx 读写 + Office 式演示编辑器。</p><p class="pp-backstage__muted">Pptx 文件进入 → 查看/编辑 → 原样导出</p>`;
|
|
190
|
+
body.appendChild(p);
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* ===================== 状态刷新 ===================== */
|
|
196
|
+
|
|
197
|
+
refresh() {
|
|
198
|
+
const app = this.app;
|
|
199
|
+
this.nameEl.textContent = app.doc.name || '新建演示';
|
|
200
|
+
this.nameEl.title = this.nameEl.textContent;
|
|
201
|
+
document.title = `${this.nameEl.textContent} - 挂逼演示`;
|
|
202
|
+
this.stateEl.textContent = app.dirty
|
|
203
|
+
? '未保存'
|
|
204
|
+
: app.doc.handle ? '已保存' : (app.doc.savedAt ? '已保存副本' : '尚未保存');
|
|
205
|
+
this.stateEl.classList.toggle('gbp-is-dirty', app.dirty);
|
|
206
|
+
this.saveBtn.disabled = !app.snapshot.slides.length;
|
|
207
|
+
}
|
|
208
|
+
}
|