plusui-native-core 0.1.35 → 0.1.36
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.
|
@@ -79,15 +79,38 @@ Window Window::create(void *windowHandle, const WindowConfig &config) {
|
|
|
79
79
|
.c_str(),
|
|
80
80
|
nullptr);
|
|
81
81
|
|
|
82
|
-
//
|
|
82
|
+
// Hide scrollbars if disabled via CSS injection
|
|
83
83
|
if (!pImpl->config.scrollbars) {
|
|
84
|
+
// First, inject a style that will execute immediately on document creation
|
|
84
85
|
std::string scrollbarScript = R"(
|
|
85
86
|
(function() {
|
|
86
|
-
|
|
87
|
+
// Apply CSS directly to documentElement immediately
|
|
88
|
+
if (document.documentElement) {
|
|
89
|
+
document.documentElement.style.overflow = 'hidden';
|
|
90
|
+
document.documentElement.style.margin = '0';
|
|
91
|
+
document.documentElement.style.padding = '0';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Create and inject style element
|
|
87
95
|
var style = document.createElement('style');
|
|
88
96
|
style.type = 'text/css';
|
|
89
|
-
style.
|
|
90
|
-
|
|
97
|
+
style.textContent = 'html { overflow: hidden !important; margin: 0 !important; padding: 0 !important; } body { overflow: hidden !important; margin: 0 !important; padding: 0 !important; } ::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }';
|
|
98
|
+
|
|
99
|
+
function attachStyle() {
|
|
100
|
+
try {
|
|
101
|
+
if (document.head) {
|
|
102
|
+
document.head.insertBefore(style, document.head.firstChild);
|
|
103
|
+
} else if (document.documentElement) {
|
|
104
|
+
document.documentElement.insertBefore(style, document.documentElement.firstChild);
|
|
105
|
+
} else {
|
|
106
|
+
setTimeout(attachStyle, 10);
|
|
107
|
+
}
|
|
108
|
+
} catch (e) {
|
|
109
|
+
// Ignore errors
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
attachStyle();
|
|
91
114
|
})();
|
|
92
115
|
)";
|
|
93
116
|
pImpl->webview->AddScriptToExecuteOnDocumentCreated(
|