plusui-native-core 0.1.35 → 0.1.37
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.
|
@@ -64,6 +64,17 @@ Window Window::create(void *windowHandle, const WindowConfig &config) {
|
|
|
64
64
|
pImpl->nativeWebView = pImpl->webview.Get();
|
|
65
65
|
pImpl->ready = true;
|
|
66
66
|
|
|
67
|
+
// Disable scrollbars at the control level if configured
|
|
68
|
+
if (!pImpl->config.scrollbars) {
|
|
69
|
+
ComPtr<ICoreWebView2Settings> settings;
|
|
70
|
+
pImpl->webview->get_Settings(&settings);
|
|
71
|
+
if (settings) {
|
|
72
|
+
// Attempt to disable scrollbars if this API is available
|
|
73
|
+
// Note: This may not be available in all WebView2 versions
|
|
74
|
+
// The CSS injection below will serve as fallback
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
67
78
|
// Inject bridge script that runs on EVERY document
|
|
68
79
|
// (survives navigation)
|
|
69
80
|
std::string bridgeScript = R"(
|
|
@@ -79,15 +90,49 @@ Window Window::create(void *windowHandle, const WindowConfig &config) {
|
|
|
79
90
|
.c_str(),
|
|
80
91
|
nullptr);
|
|
81
92
|
|
|
82
|
-
//
|
|
93
|
+
// Hide scrollbars if disabled via comprehensive CSS injection
|
|
83
94
|
if (!pImpl->config.scrollbars) {
|
|
84
95
|
std::string scrollbarScript = R"(
|
|
85
96
|
(function() {
|
|
86
|
-
|
|
97
|
+
// Critical: Apply inline styles to prevent scrollbars
|
|
98
|
+
if (document.documentElement) {
|
|
99
|
+
document.documentElement.style.cssText = 'margin:0 !important;padding:0 !important;overflow:hidden !important;width:100%;height:100%;';
|
|
100
|
+
}
|
|
101
|
+
if (document.body) {
|
|
102
|
+
document.body.style.cssText = 'margin:0 !important;padding:0 !important;overflow:hidden !important;width:100%;height:100%;';
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Create comprehensive style element
|
|
87
106
|
var style = document.createElement('style');
|
|
88
107
|
style.type = 'text/css';
|
|
89
|
-
style.
|
|
90
|
-
|
|
108
|
+
style.textContent = 'html,body{margin:0!important;padding:0!important;overflow:hidden!important;width:100%;height:100%;position:fixed;top:0;left:0;}*{scrollbar-width:none;}::-webkit-scrollbar{display:none!important;width:0!important;height:0!important;}body *{overflow:hidden!important;}';
|
|
109
|
+
|
|
110
|
+
function applyStyle() {
|
|
111
|
+
try {
|
|
112
|
+
if (document.head) {
|
|
113
|
+
document.head.insertBefore(style, document.head.firstChild);
|
|
114
|
+
} else if (document.documentElement) {
|
|
115
|
+
document.documentElement.insertBefore(style, document.documentElement.firstChild);
|
|
116
|
+
} else {
|
|
117
|
+
setTimeout(applyStyle, 10);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
} catch (e) {}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
applyStyle();
|
|
124
|
+
|
|
125
|
+
// Also apply when DOM is fully ready
|
|
126
|
+
if (document.readyState === 'loading') {
|
|
127
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
128
|
+
if (document.documentElement) {
|
|
129
|
+
document.documentElement.style.overflow = 'hidden';
|
|
130
|
+
}
|
|
131
|
+
if (document.body) {
|
|
132
|
+
document.body.style.overflow = 'hidden';
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
91
136
|
})();
|
|
92
137
|
)";
|
|
93
138
|
pImpl->webview->AddScriptToExecuteOnDocumentCreated(
|