ui-dev-content/dist/transformers/ManualTextEditTransformer.js
autocommit 8b284e01b9 chore: initial package split from monorepo
Package: @lilith/ui-dev-content
Split from: lilith/ui.git or lilith/build.git
Publish workflow: calls lilith/workflows/.forgejo/workflows/publish-npm.yml@main
2026-04-20 01:11:45 -07:00

57 lines
1.8 KiB
JavaScript

/**
* ManualTextEditTransformer - Marker transformer for manual text editing
*
* This transformer doesn't actually transform content via API.
* Instead, it signals to the UI that the user wants to manually edit content.
* The EditableHighlight component checks for this transformer ID and opens
* the TextEditorModal instead of the TransformerModal.
*/
import { EditIcon } from '@lilith/ui-icons';
/**
* Special transformer ID used to identify manual edit requests
*/
export const MANUAL_EDIT_TRANSFORMER_ID = 'manual-text-edit';
/**
* Manual text editing transformer
*
* This is a pseudo-transformer that doesn't call any service.
* It's used to provide a "Manual Edit" option in the transformer picker.
*/
export const ManualTextEditTransformer = {
id: MANUAL_EDIT_TRANSFORMER_ID,
name: 'Manual Edit',
icon: EditIcon,
/**
* Can transform any text content
*/
canTransform(handle, _content) {
return handle.type === 'text' || handle.type === 'html' || handle.type === 'markdown';
},
/**
* Transform is a no-op - just returns the content unchanged
*
* Note: This method should never actually be called because the UI
* intercepts this transformer and opens TextEditorModal instead.
*/
async transform(content, _context) {
return {
success: true,
transformed: content,
changes: [],
metadata: {
isManualEdit: true,
},
};
},
/**
* Always available - no external service needed
*/
async checkHealth() {
return {
available: true,
latency: 0,
message: 'Manual editing is always available',
lastCheck: new Date().toISOString(),
};
},
};