@fc-components/monaco-editor 0.3.3 → 0.3.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/dist/monaco-editor.cjs.development.js +22 -6
- package/dist/monaco-editor.cjs.development.js.map +1 -1
- package/dist/monaco-editor.cjs.production.min.js +1 -1
- package/dist/monaco-editor.cjs.production.min.js.map +1 -1
- package/dist/monaco-editor.esm.js +22 -6
- package/dist/monaco-editor.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/sql/format.ts +5 -0
- package/src/sql/index.tsx +3 -1
package/package.json
CHANGED
package/src/sql/format.ts
CHANGED
|
@@ -5,6 +5,11 @@ export function formatSql(sql: string): string {
|
|
|
5
5
|
return format(sql, {
|
|
6
6
|
tabWidth: 2,
|
|
7
7
|
keywordCase: 'upper',
|
|
8
|
+
// Treat custom $__ prefixed macros (like $__timeFilter, $__timeRange, etc.)
|
|
9
|
+
// as parameter placeholders so the formatter doesn't choke on them.
|
|
10
|
+
paramTypes: {
|
|
11
|
+
custom: [{ regex: String.raw`\$__[a-zA-Z_][a-zA-Z0-9_]*` }],
|
|
12
|
+
},
|
|
8
13
|
});
|
|
9
14
|
} catch {
|
|
10
15
|
// If formatting fails, return the original SQL
|
package/src/sql/index.tsx
CHANGED
|
@@ -335,7 +335,9 @@ const SqlEditor = forwardRef<SqlEditorHandle, SqlEditorProps>((props, ref) => {
|
|
|
335
335
|
</div>
|
|
336
336
|
{enableFormat &&
|
|
337
337
|
(renderFormatButton ? (
|
|
338
|
-
|
|
338
|
+
<div style={{ position: 'absolute', top: 4, right: 4, zIndex: 10 }} onClick={handleFormat}>
|
|
339
|
+
{renderFormatButton(handleFormat)}
|
|
340
|
+
</div>
|
|
339
341
|
) : (
|
|
340
342
|
<button
|
|
341
343
|
onClick={handleFormat}
|