overtype 2.1.1 → 2.2.0

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/src/themes.js CHANGED
@@ -39,6 +39,7 @@ export const solar = {
39
39
  toolbarIcon: '#0d3b66', // Yale Blue - icon color
40
40
  toolbarHover: '#f5f5f5', // Light gray - hover background
41
41
  toolbarActive: '#faf0ca', // Lemon Chiffon - active button background
42
+ placeholder: '#999999', // Gray - placeholder text
42
43
  }
43
44
  };
44
45
 
@@ -78,6 +79,7 @@ export const cave = {
78
79
  toolbarIcon: '#c5dde8', // Light blue-gray - icon color
79
80
  toolbarHover: '#243546', // Slightly lighter charcoal - hover background
80
81
  toolbarActive: '#2a3f52', // Even lighter - active button background
82
+ placeholder: '#6a7a88', // Muted blue-gray - placeholder text
81
83
  }
82
84
  };
83
85
 
@@ -87,6 +89,7 @@ export const cave = {
87
89
  export const themes = {
88
90
  solar,
89
91
  cave,
92
+ auto: solar,
90
93
  // Aliases for backward compatibility
91
94
  light: solar,
92
95
  dark: cave
@@ -106,6 +109,17 @@ export function getTheme(theme) {
106
109
  return theme;
107
110
  }
108
111
 
112
+ /**
113
+ * Resolve auto theme to actual theme based on system color scheme
114
+ * @param {string} themeName - Theme name to resolve
115
+ * @returns {string} Resolved theme name ('solar' or 'cave' if auto, otherwise unchanged)
116
+ */
117
+ export function resolveAutoTheme(themeName) {
118
+ if (themeName !== 'auto') return themeName;
119
+ const mq = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)');
120
+ return mq?.matches ? 'cave' : 'solar';
121
+ }
122
+
109
123
  /**
110
124
  * Apply theme colors to CSS variables
111
125
  * @param {Object} colors - Theme colors object
@@ -142,6 +142,29 @@ export const toolbarButtons = {
142
142
  }
143
143
  },
144
144
 
145
+ upload: {
146
+ name: 'upload',
147
+ actionId: 'uploadFile',
148
+ icon: icons.uploadIcon,
149
+ title: 'Upload File',
150
+ action: ({ editor }) => {
151
+ if (!editor.options.fileUpload?.enabled) return;
152
+ const input = document.createElement('input');
153
+ input.type = 'file';
154
+ input.multiple = true;
155
+ if (editor.options.fileUpload.mimeTypes?.length > 0) {
156
+ input.accept = editor.options.fileUpload.mimeTypes.join(',');
157
+ }
158
+ input.onchange = () => {
159
+ if (!input.files?.length) return;
160
+ const dt = new DataTransfer();
161
+ for (const f of input.files) dt.items.add(f);
162
+ editor._handleDataTransfer(dt);
163
+ };
164
+ input.click();
165
+ }
166
+ },
167
+
145
168
  viewMode: {
146
169
  name: 'viewMode',
147
170
  icon: icons.eyeIcon,
package/src/toolbar.js CHANGED
@@ -287,6 +287,18 @@ export class Toolbar {
287
287
  }
288
288
  }
289
289
 
290
+ show() {
291
+ if (this.container) {
292
+ this.container.classList.remove('overtype-toolbar-hidden');
293
+ }
294
+ }
295
+
296
+ hide() {
297
+ if (this.container) {
298
+ this.container.classList.add('overtype-toolbar-hidden');
299
+ }
300
+ }
301
+
290
302
  /**
291
303
  * Destroy toolbar and cleanup
292
304
  */