@a200888213/gbdocx 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 +1 -1
- package/src/app/word/view.js +16 -4
- package/src/app/word-app.js +2 -0
package/package.json
CHANGED
package/src/app/word/view.js
CHANGED
|
@@ -43,10 +43,22 @@ function toggleFullscreen() {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function setPageFullscreen(on) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
const next = !!on;
|
|
47
|
+
if (next === this.pageFullscreen) return;
|
|
48
|
+
this.pageFullscreen = next;
|
|
49
|
+
if (next) {
|
|
50
|
+
// [坑] 页面主容器常是 position:fixed(自带层叠上下文),留在原位压不过全局顶栏;
|
|
51
|
+
// 整个 .word-scope 挂到 body 顶层,作用域样式随节点一起走
|
|
52
|
+
this.fsHome = { parent: this.scopeEl.parentNode, next: this.scopeEl.nextSibling };
|
|
53
|
+
this.root.classList.add('gbd-is-pagefullscreen');
|
|
54
|
+
document.body.appendChild(this.scopeEl);
|
|
55
|
+
document.addEventListener('keydown', this.onFullscreenEsc, true);
|
|
56
|
+
} else {
|
|
57
|
+
this.root.classList.remove('gbd-is-pagefullscreen');
|
|
58
|
+
if (this.fsHome?.parent) this.fsHome.parent.insertBefore(this.scopeEl, this.fsHome.next);
|
|
59
|
+
this.fsHome = null;
|
|
60
|
+
document.removeEventListener('keydown', this.onFullscreenEsc, true);
|
|
61
|
+
}
|
|
50
62
|
this.renderFullscreenBtn();
|
|
51
63
|
}
|
|
52
64
|
|
package/src/app/word-app.js
CHANGED