plusui-native-core 0.1.36 → 0.1.38

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,38 +90,49 @@ Window Window::create(void *windowHandle, const WindowConfig &config) {
79
90
  .c_str(),
80
91
  nullptr);
81
92
 
82
- // Hide scrollbars if disabled via CSS injection
93
+ // Hide scrollbars if disabled via comprehensive CSS injection
83
94
  if (!pImpl->config.scrollbars) {
84
- // First, inject a style that will execute immediately on document creation
85
95
  std::string scrollbarScript = R"(
86
96
  (function() {
87
- // Apply CSS directly to documentElement immediately
97
+ // Critical: Apply inline styles to prevent scrollbars
88
98
  if (document.documentElement) {
89
- document.documentElement.style.overflow = 'hidden';
90
- document.documentElement.style.margin = '0';
91
- document.documentElement.style.padding = '0';
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%;';
92
103
  }
93
104
 
94
- // Create and inject style element
105
+ // Create comprehensive style element
95
106
  var style = document.createElement('style');
96
107
  style.type = 'text/css';
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; }';
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;}';
98
109
 
99
- function attachStyle() {
110
+ function applyStyle() {
100
111
  try {
101
112
  if (document.head) {
102
113
  document.head.insertBefore(style, document.head.firstChild);
103
114
  } else if (document.documentElement) {
104
115
  document.documentElement.insertBefore(style, document.documentElement.firstChild);
105
116
  } else {
106
- setTimeout(attachStyle, 10);
117
+ setTimeout(applyStyle, 10);
118
+ return;
107
119
  }
108
- } catch (e) {
109
- // Ignore errors
110
- }
120
+ } catch (e) {}
111
121
  }
112
122
 
113
- attachStyle();
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
+ }
114
136
  })();
115
137
  )";
116
138
  pImpl->webview->AddScriptToExecuteOnDocumentCreated(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plusui-native-core",
3
- "version": "0.1.36",
3
+ "version": "0.1.38",
4
4
  "description": "PlusUI Core framework (frontend + backend implementations)",
5
5
  "type": "module",
6
6
  "files": [