gbpptx 0.5.1 → 0.5.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gbpptx",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Office-style PowerPoint (pptx) editor: real PresentationML read/write, ribbon UI, slide sorter, presenter view.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -131,10 +131,22 @@ function toggleFullscreen() {
131
131
  }
132
132
 
133
133
  function setPageFullscreen(on) {
134
- this.pageFullscreen = !!on;
135
- this.root.classList.toggle('gbp-is-pagefullscreen', this.pageFullscreen);
136
- if (this.pageFullscreen) document.addEventListener('keydown', this.onFullscreenEsc, true);
137
- else document.removeEventListener('keydown', this.onFullscreenEsc, true);
134
+ const next = !!on;
135
+ if (next === this.pageFullscreen) return;
136
+ this.pageFullscreen = next;
137
+ if (next) {
138
+ // [坑] 页面主容器常是 position:fixed(自带层叠上下文),留在原位压不过全局顶栏;
139
+ // 全屏期间临时挂到 body 顶层,并补上作用域类(重置/滚动条规则挂在 .gbp-root 上)
140
+ this.fsHome = { parent: this.root.parentNode, next: this.root.nextSibling };
141
+ this.root.classList.add('gbp-root', 'gbp-is-pagefullscreen');
142
+ document.body.appendChild(this.root);
143
+ document.addEventListener('keydown', this.onFullscreenEsc, true);
144
+ } else {
145
+ this.root.classList.remove('gbp-is-pagefullscreen', 'gbp-root');
146
+ if (this.fsHome?.parent) this.fsHome.parent.insertBefore(this.root, this.fsHome.next);
147
+ this.fsHome = null;
148
+ document.removeEventListener('keydown', this.onFullscreenEsc, true);
149
+ }
138
150
  this.titlebar?.refresh();
139
151
  }
140
152
 
@@ -255,6 +255,8 @@ export class SlidesApp {
255
255
  }
256
256
 
257
257
  destroy() {
258
+ // 全屏中的根节点挂在 body 上:先归还原位,宿主随后清空挂载点时才能一并移除
259
+ if (this.pageFullscreen) this.setPageFullscreen(false);
258
260
  this.canvas?.unbindWheel?.();
259
261
  this.presenter?.close();
260
262
  clearTimeout(this.autosaveTimer);