scribe-widget 1.0.4 → 1.0.5

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": "scribe-widget",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Floating panel widget for medical transcription using eka.scribe",
5
5
  "main": "dist/scribe-widget.umd.js",
6
6
  "module": "dist/scribe-widget.es.js",
package/src/index.tsx CHANGED
@@ -44,18 +44,12 @@ class ScribeWidget {
44
44
  private render(): void {
45
45
  if (!this.root || !this.visible) return;
46
46
 
47
- this.root.render(
48
- <App
49
- config={this.config}
50
- onClose={() => this.hide()}
51
- />
52
- );
47
+ this.root.render(<App config={this.config} onClose={() => this.hide()} />);
53
48
  }
54
49
 
55
50
  public mount(target?: HTMLElement | string): void {
56
- const targetEl = typeof target === 'string'
57
- ? document.querySelector(target)
58
- : target || document.body;
51
+ const targetEl =
52
+ typeof target === 'string' ? document.querySelector(target) : target || document.body;
59
53
 
60
54
  if (targetEl) {
61
55
  targetEl.appendChild(this.container);
@@ -94,6 +88,8 @@ function init(config: ScribeWidgetConfig = {} as ScribeWidgetConfig): ScribeWidg
94
88
  if (widgetInstance) {
95
89
  widgetInstance.unmount();
96
90
  }
91
+
92
+ console.log(config, 'config - WIDGET');
97
93
  widgetInstance = new ScribeWidget(config);
98
94
  widgetInstance.mount();
99
95
  return widgetInstance;
@@ -120,11 +116,13 @@ export default EkaScribe;
120
116
  if (typeof window !== 'undefined' && typeof document !== 'undefined') {
121
117
  const autoInit = () => {
122
118
  // Don't auto-init if already initialized or if data-no-auto-init attribute is present
123
- const scriptTag = document.currentScript || document.querySelector('script[src*="scribe-widget"]');
119
+ const scriptTag =
120
+ document.currentScript || document.querySelector('script[src*="scribe-widget"]');
124
121
  if (scriptTag?.hasAttribute('data-no-auto-init')) {
125
122
  return;
126
123
  }
127
124
 
125
+ console.log(widgetInstance, 'widget instance');
128
126
  if (!widgetInstance) {
129
127
  init({});
130
128
  }
@@ -132,9 +130,11 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
132
130
 
133
131
  // Run after DOM is ready
134
132
  if (document.readyState === 'loading') {
135
- document.addEventListener('DOMContentLoaded', autoInit);
133
+ document.addEventListener('DOMContentLoaded - WIDGET', autoInit);
136
134
  } else {
137
135
  // DOM already loaded, init immediately
136
+
137
+ console.log('load document - WIDGET');
138
138
  autoInit();
139
139
  }
140
140
  }