@cozeloop/prompt-components 0.0.2 → 0.0.4
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/es/basic-editor/custom-facet.js +9 -0
- package/dist/es/basic-editor/diff.js +138 -0
- package/dist/{go-syntax-067c4f5d.mjs → es/basic-editor/extensions/go-syntax.js} +9 -16
- package/dist/es/basic-editor/extensions/go-template.js +16 -0
- package/dist/{go-theme-062a6df6.mjs → es/basic-editor/extensions/go-theme.js} +4 -3
- package/dist/es/basic-editor/extensions/jinja.js +80 -0
- package/dist/es/basic-editor/extensions/keymap.js +442 -0
- package/dist/es/basic-editor/extensions/language-support.js +12 -0
- package/dist/es/basic-editor/extensions/markdown.js +58 -0
- package/dist/es/basic-editor/extensions/search/dom/icon.js +250 -0
- package/dist/es/basic-editor/extensions/search/dom/match-count.js +33 -0
- package/dist/es/basic-editor/extensions/search/index.js +18 -0
- package/dist/es/basic-editor/extensions/search/panel.js +418 -0
- package/dist/es/basic-editor/extensions/search/theme.js +184 -0
- package/dist/es/basic-editor/extensions/validation.js +84 -0
- package/dist/es/basic-editor/extensions/validation.module.js +5 -0
- package/dist/es/basic-editor/extensions/validation_module.css +7 -0
- package/dist/es/basic-editor/extensions/variable.js +178 -0
- package/dist/es/basic-editor/index.js +171 -0
- package/dist/es/code-editor/code-editor.js +83 -0
- package/dist/es/code-editor/index.js +12 -0
- package/dist/es/code-editor/json-editor.js +157 -0
- package/dist/es/code-editor/raw-text-editor.js +46 -0
- package/dist/es/code-editor/text-editor.js +41 -0
- package/dist/es/code-editor/themes/coze-dark.js +112 -0
- package/dist/es/code-editor/themes/coze-light.js +118 -0
- package/dist/es/consts/index.js +12 -0
- package/dist/es/dev-layout/index.js +35 -0
- package/dist/es/idls/fornax_ml_flow2/index.js +2293 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/ai_annotate.js +41 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/aidpcallback.js +108 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/annotation_job.js +52 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/base.js +0 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/batch_infer.js +72 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/dataprocess.js +10 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/dataset.js +36 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/datasetv2.js +139 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/datasetv2job.js +40 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/datasetv2similarity.js +12 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/filter.js +0 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/flow_devops_evaluation_callback_common.js +36 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/flow_devops_prompt_common.js +318 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/fornax_domain_model.js +326 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/ml_flow_domain_model.js +327 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/openapi.js +0 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_annotateservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_annotationjobservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_batchinferservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_crowdsourcingannotationjobservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_dataprocessservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_datasetservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_datasetservicev2.js +0 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_modelservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_openapi_annotationjobservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_openapi_batchinferservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_openapi_datasetservicev2.js +0 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_tagservice.js +0 -0
- package/dist/es/idls/fornax_ml_flow2/namespaces/tag.js +33 -0
- package/dist/es/idls/prompt_api2/index.js +1995 -0
- package/dist/es/idls/prompt_api2/namespaces/base.js +0 -0
- package/dist/es/idls/prompt_api2/namespaces/flow_devops_prompt_callback.js +35 -0
- package/dist/es/idls/prompt_api2/namespaces/flow_devops_prompt_commercial_openapi.js +0 -0
- package/dist/es/idls/prompt_api2/namespaces/flow_devops_prompt_common.js +318 -0
- package/dist/es/idls/prompt_api2/namespaces/flow_devops_prompt_debug.js +0 -0
- package/dist/es/idls/prompt_api2/namespaces/flow_devops_prompt_manage.js +23 -0
- package/dist/es/idls/prompt_api2/namespaces/flow_devops_prompt_mcp.js +0 -0
- package/dist/es/idls/prompt_api2/namespaces/flow_devops_prompt_optimize.js +0 -0
- package/dist/es/idls/prompt_api2/namespaces/flow_devops_prompt_paas.js +43 -0
- package/dist/es/idls/prompt_api2/namespaces/flow_devops_prompt_platform.js +0 -0
- package/dist/es/idls/prompt_api2/namespaces/mcp.js +9 -0
- package/dist/es/idls/prompt_api2/namespaces/model.js +320 -0
- package/dist/es/idls/prompt_api2/namespaces/permission.js +47 -0
- package/dist/es/idls/prompt_api2/namespaces/release.js +25 -0
- package/dist/es/index.js +66 -0
- package/dist/es/mermaid-diagram/index.js +148 -0
- package/dist/es/mermaid-diagram/index.module.js +5 -0
- package/dist/es/mermaid-diagram/index_module.css +4 -0
- package/dist/es/mermaid-diagram/use-svg-pan-zoom.js +49 -0
- package/dist/es/mermaid-diagram/utils.js +74 -0
- package/dist/es/model-config-editor/basic-type.js +71 -0
- package/dist/es/model-config-editor/index.module.js +5 -0
- package/dist/es/model-config-editor/index_module.css +8 -0
- package/dist/es/model-config-editor/model-config-form.js +132 -0
- package/dist/es/model-config-editor/popover-type.js +118 -0
- package/dist/es/model-select/index.js +136 -0
- package/dist/es/model-select/index.module.js +5 -0
- package/dist/es/model-select/index_module.css +14 -0
- package/dist/es/model-select/model-option/index.js +161 -0
- package/dist/es/model-select/model-option/index.module.js +5 -0
- package/dist/es/model-select/model-option/index_module.css +23 -0
- package/dist/es/model-select/model-option-group/index.js +44 -0
- package/dist/es/prompt-editor/index.js +188 -0
- package/dist/es/prompt-editor/index.module.js +5 -0
- package/dist/es/prompt-editor/index_module.css +71 -0
- package/dist/es/prompt-editor/message-type-select.js +74 -0
- package/dist/es/schema-editor/index.js +43 -0
- package/dist/es/utils/base.js +53 -0
- package/dist/es/utils/model-config.js +32 -0
- package/dist/lib/basic-editor/custom-facet.js +33 -0
- package/dist/lib/basic-editor/diff.js +167 -0
- package/dist/lib/basic-editor/extensions/go-syntax.js +146 -0
- package/dist/lib/basic-editor/extensions/go-template.js +50 -0
- package/dist/lib/basic-editor/extensions/go-theme.js +1091 -0
- package/dist/lib/basic-editor/extensions/jinja.js +100 -0
- package/dist/lib/basic-editor/extensions/keymap.js +465 -0
- package/dist/lib/basic-editor/extensions/language-support.js +32 -0
- package/dist/lib/basic-editor/extensions/markdown.js +78 -0
- package/dist/lib/basic-editor/extensions/search/dom/icon.js +291 -0
- package/dist/lib/basic-editor/extensions/search/dom/match-count.js +67 -0
- package/dist/lib/basic-editor/extensions/search/index.js +38 -0
- package/dist/lib/basic-editor/extensions/search/panel.js +429 -0
- package/dist/lib/basic-editor/extensions/search/theme.js +208 -0
- package/dist/lib/basic-editor/extensions/validation.js +118 -0
- package/dist/lib/basic-editor/extensions/validation.module.js +25 -0
- package/dist/lib/basic-editor/extensions/validation_module.css +7 -0
- package/dist/lib/basic-editor/extensions/variable.js +190 -0
- package/dist/lib/basic-editor/index.js +193 -0
- package/dist/lib/code-editor/code-editor.js +117 -0
- package/dist/lib/code-editor/index.js +40 -0
- package/dist/lib/code-editor/json-editor.js +184 -0
- package/dist/lib/code-editor/raw-text-editor.js +70 -0
- package/dist/lib/code-editor/text-editor.js +75 -0
- package/dist/lib/code-editor/themes/coze-dark.js +136 -0
- package/dist/lib/code-editor/themes/coze-light.js +142 -0
- package/dist/lib/consts/index.js +38 -0
- package/dist/lib/dev-layout/index.js +69 -0
- package/dist/lib/idls/fornax_ml_flow2/index.js +2355 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/ai_annotate.js +69 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/aidpcallback.js +140 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/annotation_job.js +82 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/base.js +16 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/batch_infer.js +105 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/dataprocess.js +34 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/dataset.js +63 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/datasetv2.js +177 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/datasetv2job.js +68 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/datasetv2similarity.js +37 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/filter.js +16 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/flow_devops_evaluation_callback_common.js +62 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/flow_devops_prompt_common.js +378 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/fornax_domain_model.js +384 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/ml_flow_domain_model.js +385 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/openapi.js +16 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_annotateservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_annotationjobservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_batchinferservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_crowdsourcingannotationjobservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_dataprocessservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_datasetservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_datasetservicev2.js +16 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_modelservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_openapi_annotationjobservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_openapi_batchinferservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_openapi_datasetservicev2.js +16 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_tagservice.js +16 -0
- package/dist/lib/idls/fornax_ml_flow2/namespaces/tag.js +60 -0
- package/dist/lib/idls/prompt_api2/index.js +2042 -0
- package/dist/lib/idls/prompt_api2/namespaces/base.js +16 -0
- package/dist/lib/idls/prompt_api2/namespaces/flow_devops_prompt_callback.js +62 -0
- package/dist/lib/idls/prompt_api2/namespaces/flow_devops_prompt_commercial_openapi.js +16 -0
- package/dist/lib/idls/prompt_api2/namespaces/flow_devops_prompt_common.js +378 -0
- package/dist/lib/idls/prompt_api2/namespaces/flow_devops_prompt_debug.js +16 -0
- package/dist/lib/idls/prompt_api2/namespaces/flow_devops_prompt_manage.js +49 -0
- package/dist/lib/idls/prompt_api2/namespaces/flow_devops_prompt_mcp.js +16 -0
- package/dist/lib/idls/prompt_api2/namespaces/flow_devops_prompt_optimize.js +16 -0
- package/dist/lib/idls/prompt_api2/namespaces/flow_devops_prompt_paas.js +72 -0
- package/dist/lib/idls/prompt_api2/namespaces/flow_devops_prompt_platform.js +16 -0
- package/dist/lib/idls/prompt_api2/namespaces/mcp.js +33 -0
- package/dist/lib/idls/prompt_api2/namespaces/model.js +377 -0
- package/dist/lib/idls/prompt_api2/namespaces/permission.js +72 -0
- package/dist/lib/idls/prompt_api2/namespaces/release.js +50 -0
- package/dist/lib/index.js +110 -0
- package/dist/lib/mermaid-diagram/index.js +174 -0
- package/dist/lib/mermaid-diagram/index.module.js +25 -0
- package/dist/lib/mermaid-diagram/index_module.css +4 -0
- package/dist/lib/mermaid-diagram/use-svg-pan-zoom.js +83 -0
- package/dist/lib/mermaid-diagram/utils.js +98 -0
- package/dist/lib/model-config-editor/basic-type.js +103 -0
- package/dist/lib/model-config-editor/index.module.js +25 -0
- package/dist/lib/model-config-editor/index_module.css +8 -0
- package/dist/lib/model-config-editor/model-config-form.js +151 -0
- package/dist/lib/model-config-editor/popover-type.js +145 -0
- package/dist/lib/model-select/index.js +170 -0
- package/dist/lib/model-select/index.module.js +25 -0
- package/dist/lib/model-select/index_module.css +14 -0
- package/dist/lib/model-select/model-option/index.js +188 -0
- package/dist/lib/model-select/model-option/index.module.js +25 -0
- package/dist/lib/model-select/model-option/index_module.css +23 -0
- package/dist/lib/model-select/model-option-group/index.js +75 -0
- package/dist/lib/prompt-editor/index.js +218 -0
- package/dist/lib/prompt-editor/index.module.js +25 -0
- package/dist/lib/prompt-editor/index_module.css +71 -0
- package/dist/lib/prompt-editor/message-type-select.js +108 -0
- package/dist/lib/schema-editor/index.js +77 -0
- package/dist/lib/utils/base.js +82 -0
- package/dist/lib/utils/model-config.js +57 -0
- package/dist/{src → types}/basic-editor/custom-facet.d.ts +1 -2
- package/dist/types/basic-editor/diff.d.ts +15 -0
- package/dist/types/basic-editor/extensions/go-syntax.d.ts +71 -0
- package/dist/types/basic-editor/extensions/go-template.d.ts +1 -0
- package/dist/{src → types}/basic-editor/extensions/go-theme.d.ts +1 -1
- package/dist/types/basic-editor/extensions/jinja.d.ts +6 -0
- package/dist/{src → types}/basic-editor/extensions/keymap.d.ts +2 -3
- package/dist/types/basic-editor/extensions/language-support.d.ts +2 -0
- package/dist/types/basic-editor/extensions/markdown.d.ts +2 -0
- package/dist/types/basic-editor/extensions/search/dom/icon.d.ts +59 -0
- package/dist/types/basic-editor/extensions/search/dom/match-count.d.ts +14 -0
- package/dist/types/basic-editor/extensions/search/index.d.ts +1 -0
- package/dist/types/basic-editor/extensions/search/panel.d.ts +32 -0
- package/dist/types/basic-editor/extensions/search/theme.d.ts +1 -0
- package/dist/types/basic-editor/extensions/validation.d.ts +10 -0
- package/dist/types/basic-editor/extensions/variable.d.ts +14 -0
- package/dist/types/basic-editor/index.d.ts +28 -0
- package/dist/types/code-editor/code-editor.d.ts +23 -0
- package/dist/{src → types}/code-editor/index.d.ts +1 -1
- package/dist/types/code-editor/json-editor.d.ts +17 -0
- package/dist/types/code-editor/raw-text-editor.d.ts +11 -0
- package/dist/types/code-editor/text-editor.d.ts +23 -0
- package/dist/types/code-editor/themes/coze-dark.d.ts +1 -0
- package/dist/types/code-editor/themes/coze-light.d.ts +1 -0
- package/dist/{src → types}/consts/index.d.ts +1 -1
- package/dist/types/dev-layout/index.d.ts +13 -0
- package/dist/types/idls/fornax_ml_flow2/index.d.ts +750 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/ai_annotate.d.ts +102 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/aidpcallback.d.ts +227 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/annotation_job.d.ts +402 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/base.d.ts +18 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/batch_infer.d.ts +331 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/dataprocess.d.ts +16 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/dataset.d.ts +88 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/datasetv2.d.ts +462 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/datasetv2job.d.ts +180 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/datasetv2similarity.d.ts +8 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/filter.d.ts +39 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/flow_devops_evaluation_callback_common.d.ts +88 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/flow_devops_prompt_common.d.ts +370 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/fornax_domain_model.d.ts +320 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/ml_flow_domain_model.d.ts +510 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/openapi.d.ts +6 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_annotateservice.d.ts +106 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_annotationjobservice.d.ts +256 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_batchinferservice.d.ts +73 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_crowdsourcingannotationjobservice.d.ts +94 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_dataprocessservice.d.ts +11 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_datasetservice.d.ts +24 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_datasetservicev2.d.ts +653 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_modelservice.d.ts +83 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_openapi_annotationjobservice.d.ts +81 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_openapi_batchinferservice.d.ts +24 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_openapi_datasetservicev2.d.ts +260 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/stone_fornax_ml_flow_tagservice.d.ts +111 -0
- package/dist/types/idls/fornax_ml_flow2/namespaces/tag.d.ts +109 -0
- package/dist/types/idls/prompt_api2/index.d.ts +653 -0
- package/dist/types/idls/prompt_api2/namespaces/base.d.ts +18 -0
- package/dist/types/idls/prompt_api2/namespaces/flow_devops_prompt_callback.d.ts +102 -0
- package/dist/types/idls/prompt_api2/namespaces/flow_devops_prompt_commercial_openapi.d.ts +81 -0
- package/dist/types/idls/prompt_api2/namespaces/flow_devops_prompt_common.d.ts +1270 -0
- package/dist/types/idls/prompt_api2/namespaces/flow_devops_prompt_debug.d.ts +197 -0
- package/dist/types/idls/prompt_api2/namespaces/flow_devops_prompt_manage.d.ts +769 -0
- package/dist/types/idls/prompt_api2/namespaces/flow_devops_prompt_mcp.d.ts +301 -0
- package/dist/types/idls/prompt_api2/namespaces/flow_devops_prompt_optimize.d.ts +155 -0
- package/dist/types/idls/prompt_api2/namespaces/flow_devops_prompt_paas.d.ts +198 -0
- package/dist/types/idls/prompt_api2/namespaces/flow_devops_prompt_platform.d.ts +230 -0
- package/dist/types/idls/prompt_api2/namespaces/mcp.d.ts +95 -0
- package/dist/types/idls/prompt_api2/namespaces/model.d.ts +315 -0
- package/dist/types/idls/prompt_api2/namespaces/permission.d.ts +52 -0
- package/dist/types/idls/prompt_api2/namespaces/release.d.ts +62 -0
- package/dist/{src → types}/index.d.ts +7 -7
- package/dist/types/mermaid-diagram/index.d.ts +12 -0
- package/dist/types/mermaid-diagram/use-svg-pan-zoom.d.ts +17 -0
- package/dist/{src → types}/mermaid-diagram/utils.d.ts +1 -1
- package/dist/types/model-config-editor/basic-type.d.ts +19 -0
- package/dist/types/model-config-editor/model-config-form.d.ts +14 -0
- package/dist/types/model-config-editor/popover-type.d.ts +25 -0
- package/dist/types/model-select/index.d.ts +38 -0
- package/dist/types/model-select/model-option/index.d.ts +30 -0
- package/dist/types/model-select/model-option-group/index.d.ts +15 -0
- package/dist/types/prompt-editor/index.d.ts +30 -0
- package/dist/types/prompt-editor/message-type-select.d.ts +16 -0
- package/dist/types/schema-editor/index.d.ts +18 -0
- package/dist/{src → types}/utils/base.d.ts +4 -5
- package/dist/types/utils/model-config.d.ts +4 -0
- package/package.json +9 -13
- package/dist/edenx.config.d.ts +0 -2
- package/dist/go-syntax-4deb0289.js +0 -8
- package/dist/go-theme-fbd8a4fa.js +0 -1
- package/dist/index.cjs +0 -61
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -2788
- package/dist/src/basic-editor/diff.d.ts +0 -16
- package/dist/src/basic-editor/extensions/go-syntax.d.ts +0 -71
- package/dist/src/basic-editor/extensions/go-template.d.ts +0 -1
- package/dist/src/basic-editor/extensions/jinja.d.ts +0 -4
- package/dist/src/basic-editor/extensions/language-support.d.ts +0 -2
- package/dist/src/basic-editor/extensions/markdown.d.ts +0 -2
- package/dist/src/basic-editor/extensions/search/dom/icon.d.ts +0 -59
- package/dist/src/basic-editor/extensions/search/dom/match-count.d.ts +0 -14
- package/dist/src/basic-editor/extensions/search/index.d.ts +0 -1
- package/dist/src/basic-editor/extensions/search/panel.d.ts +0 -33
- package/dist/src/basic-editor/extensions/search/theme.d.ts +0 -1
- package/dist/src/basic-editor/extensions/validation.d.ts +0 -8
- package/dist/src/basic-editor/extensions/variable.d.ts +0 -11
- package/dist/src/basic-editor/index.d.ts +0 -29
- package/dist/src/code-editor/json-editor.d.ts +0 -18
- package/dist/src/code-editor/raw-text-editor.d.ts +0 -11
- package/dist/src/dev-layout/index.d.ts +0 -7
- package/dist/src/mermaid-diagram/index.d.ts +0 -12
- package/dist/src/mermaid-diagram/use-svg-pan-zoom.d.ts +0 -12
- package/dist/src/model-config-editor/basic-type.d.ts +0 -13
- package/dist/src/model-config-editor/model-config-form.d.ts +0 -13
- package/dist/src/model-config-editor/popover-type.d.ts +0 -19
- package/dist/src/model-select/index.d.ts +0 -27
- package/dist/src/model-select/model-option/index.d.ts +0 -25
- package/dist/src/model-select/model-option-group/index.d.ts +0 -16
- package/dist/src/prompt-editor/index.d.ts +0 -31
- package/dist/src/prompt-editor/message-type-select.d.ts +0 -11
- package/dist/src/schema-editor/index.d.ts +0 -11
- package/dist/src/utils/model-config.d.ts +0 -5
- package/dist/style.css +0 -1
- package/dist/test-build.d.ts +0 -7
- package/dist/vite.config.d.ts +0 -2
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { markdownLanguage } from "@coze-editor/editor/preset-prompt";
|
|
2
|
+
import {
|
|
3
|
+
EditorSelection,
|
|
4
|
+
countColumn
|
|
5
|
+
} from "@codemirror/state";
|
|
6
|
+
import { syntaxTree, indentUnit } from "@codemirror/language";
|
|
7
|
+
class Context {
|
|
8
|
+
constructor(props) {
|
|
9
|
+
this.node = props.node;
|
|
10
|
+
this.from = props.from;
|
|
11
|
+
this.to = props.to;
|
|
12
|
+
this.spaceBefore = props.spaceBefore;
|
|
13
|
+
this.spaceAfter = props.spaceAfter;
|
|
14
|
+
this.type = props.type;
|
|
15
|
+
this.item = props.item;
|
|
16
|
+
}
|
|
17
|
+
blank(maxWidth, trailing = true) {
|
|
18
|
+
let result = this.spaceBefore + (this.node.name === "Blockquote" ? ">" : "");
|
|
19
|
+
if (maxWidth !== null) {
|
|
20
|
+
while (result.length < maxWidth) {
|
|
21
|
+
result += " ";
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
for (let i = this.to - this.from - result.length - this.spaceAfter.length; i > 0; i--) {
|
|
26
|
+
result += " ";
|
|
27
|
+
}
|
|
28
|
+
return result + (trailing ? this.spaceAfter : "");
|
|
29
|
+
}
|
|
30
|
+
marker(doc, add) {
|
|
31
|
+
if (this.node.name === "OrderedList" && this.item) {
|
|
32
|
+
const numberMatch = itemNumber(this.item, doc);
|
|
33
|
+
if (numberMatch) {
|
|
34
|
+
const number = Number(numberMatch[2]) + add;
|
|
35
|
+
return `${this.spaceBefore}${number}.${this.spaceAfter}`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return `${this.spaceBefore}${this.type}${this.spaceAfter}`;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function getContext(node, doc) {
|
|
42
|
+
const context = [];
|
|
43
|
+
let current = node;
|
|
44
|
+
while (current) {
|
|
45
|
+
if (current.name === "FencedCode") {
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
if (current.name === "ListItem" || current.name === "Blockquote") {
|
|
49
|
+
const line = doc.lineAt(current.from);
|
|
50
|
+
const startPos = current.from - line.from;
|
|
51
|
+
const lineText = line.text.slice(startPos);
|
|
52
|
+
let contextPart = null;
|
|
53
|
+
if (current.name === "Blockquote") {
|
|
54
|
+
const match = /^ *>( ?)/.exec(lineText);
|
|
55
|
+
if (match) {
|
|
56
|
+
contextPart = new Context({
|
|
57
|
+
node: current,
|
|
58
|
+
from: startPos,
|
|
59
|
+
to: startPos + match[0].length,
|
|
60
|
+
spaceBefore: "",
|
|
61
|
+
spaceAfter: match[1],
|
|
62
|
+
type: ">",
|
|
63
|
+
item: null
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
} else if (current.name === "ListItem" && current.parent) {
|
|
67
|
+
if (current.parent.name === "OrderedList") {
|
|
68
|
+
const match = /^( *)(\d+)([.)])( *)/.exec(lineText);
|
|
69
|
+
if (match) {
|
|
70
|
+
let after = match[4];
|
|
71
|
+
let len = match[0].length;
|
|
72
|
+
if (after.length >= 4) {
|
|
73
|
+
after = after.slice(0, after.length - 4);
|
|
74
|
+
len -= 4;
|
|
75
|
+
}
|
|
76
|
+
contextPart = new Context({
|
|
77
|
+
node: current.parent,
|
|
78
|
+
from: startPos,
|
|
79
|
+
to: startPos + len,
|
|
80
|
+
spaceBefore: match[1],
|
|
81
|
+
spaceAfter: after,
|
|
82
|
+
type: match[2],
|
|
83
|
+
item: current
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
} else if (current.parent.name === "BulletList") {
|
|
87
|
+
const match = /^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(lineText);
|
|
88
|
+
if (match) {
|
|
89
|
+
let after = match[4];
|
|
90
|
+
let len = match[0].length;
|
|
91
|
+
if (after.length > 4) {
|
|
92
|
+
after = after.slice(0, after.length - 4);
|
|
93
|
+
len -= 4;
|
|
94
|
+
}
|
|
95
|
+
let type = match[2];
|
|
96
|
+
if (match[3]) {
|
|
97
|
+
type += match[3].replace(/[xX]/, " ");
|
|
98
|
+
}
|
|
99
|
+
contextPart = new Context({
|
|
100
|
+
node: current.parent,
|
|
101
|
+
from: startPos,
|
|
102
|
+
to: startPos + len,
|
|
103
|
+
spaceBefore: match[1],
|
|
104
|
+
spaceAfter: after,
|
|
105
|
+
type,
|
|
106
|
+
item: current
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (contextPart) {
|
|
112
|
+
context.unshift(contextPart);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
current = current.parent;
|
|
116
|
+
}
|
|
117
|
+
return context;
|
|
118
|
+
}
|
|
119
|
+
function itemNumber(item, doc) {
|
|
120
|
+
return /^(\s*)(\d+)(?=[.)])/.exec(doc.sliceString(item.from, item.from + 10));
|
|
121
|
+
}
|
|
122
|
+
function renumberList(after, doc, changes, offset = 0) {
|
|
123
|
+
let prev = -1;
|
|
124
|
+
let node = after;
|
|
125
|
+
while (node) {
|
|
126
|
+
if (node.name === "ListItem") {
|
|
127
|
+
const m = itemNumber(node, doc);
|
|
128
|
+
if (!m) {
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
const number = Number(m[2]);
|
|
132
|
+
if (prev >= 0) {
|
|
133
|
+
if (number !== prev + 1) {
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
changes.push({
|
|
137
|
+
from: node.from + m[1].length,
|
|
138
|
+
to: node.from + m[0].length,
|
|
139
|
+
insert: String(prev + 2 + offset)
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
prev = number;
|
|
143
|
+
}
|
|
144
|
+
node = node.nextSibling;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function normalizeIndent(content, state) {
|
|
148
|
+
const match = /^[ \t]*/.exec(content);
|
|
149
|
+
const blank = match ? match[0].length : 0;
|
|
150
|
+
if (!blank || state.facet(indentUnit) !== " ") {
|
|
151
|
+
return content;
|
|
152
|
+
}
|
|
153
|
+
const col = countColumn(content, 4, blank);
|
|
154
|
+
let space = "";
|
|
155
|
+
for (let i = col; i > 0; ) {
|
|
156
|
+
if (i >= 4) {
|
|
157
|
+
space += " ";
|
|
158
|
+
i -= 4;
|
|
159
|
+
} else {
|
|
160
|
+
space += " ";
|
|
161
|
+
i--;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return space + content.slice(blank);
|
|
165
|
+
}
|
|
166
|
+
function handleEmptyLineInList(state, context, inner, pos, line) {
|
|
167
|
+
if (!inner.item) {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
const { doc } = state;
|
|
171
|
+
const firstItem = inner.node.firstChild;
|
|
172
|
+
const secondItem = inner.node.getChild("ListItem", "ListItem");
|
|
173
|
+
if (!firstItem) {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
if (firstItem.to >= pos || secondItem && secondItem.to < pos || line.from > 0 && !/[^\s>]/.test(doc.lineAt(line.from - 1).text)) {
|
|
177
|
+
const changes = [];
|
|
178
|
+
const nextContext = context.length > 1 ? context[context.length - 2] : null;
|
|
179
|
+
let delTo;
|
|
180
|
+
let insert = "";
|
|
181
|
+
if (nextContext) {
|
|
182
|
+
delTo = line.from + (nextContext.item ? nextContext.from : nextContext.to);
|
|
183
|
+
if (nextContext.item) {
|
|
184
|
+
insert = nextContext.marker(doc, 1);
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
delTo = line.from;
|
|
188
|
+
}
|
|
189
|
+
changes.push({ from: delTo, to: pos, insert });
|
|
190
|
+
if (inner.node.name === "OrderedList" && inner.item) {
|
|
191
|
+
renumberList(inner.item, doc, changes, -2);
|
|
192
|
+
}
|
|
193
|
+
if ((nextContext == null ? void 0 : nextContext.node.name) === "OrderedList" && nextContext.item) {
|
|
194
|
+
renumberList(nextContext.item, doc, changes);
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
range: EditorSelection.cursor(delTo + insert.length),
|
|
198
|
+
changes
|
|
199
|
+
};
|
|
200
|
+
} else {
|
|
201
|
+
const insert = blankLine(context, state, line);
|
|
202
|
+
return {
|
|
203
|
+
range: EditorSelection.cursor(pos + insert.length + 1),
|
|
204
|
+
changes: { from: line.from, insert: insert + state.lineBreak }
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
function handleEmptyBlockquote(state, inner, line) {
|
|
209
|
+
if (inner.node.name !== "Blockquote" || !line.from) {
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
const prevLine = state.doc.lineAt(line.from - 1);
|
|
213
|
+
const quoted = />\s*$/.exec(prevLine.text);
|
|
214
|
+
if (quoted && quoted.index === inner.from) {
|
|
215
|
+
const changes = state.changes([
|
|
216
|
+
{ from: prevLine.from + quoted.index, to: prevLine.to },
|
|
217
|
+
{ from: line.from + inner.from, to: line.to }
|
|
218
|
+
]);
|
|
219
|
+
return {
|
|
220
|
+
range: EditorSelection.cursor(changes.mapPos(line.from)),
|
|
221
|
+
changes
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
function continueMarkup(state, context, inner, pos, line) {
|
|
227
|
+
const { doc } = state;
|
|
228
|
+
const changes = [];
|
|
229
|
+
if (inner.node.name === "OrderedList" && inner.item) {
|
|
230
|
+
renumberList(inner.item, doc, changes);
|
|
231
|
+
}
|
|
232
|
+
const continued = !!inner.item && inner.item.from < line.from;
|
|
233
|
+
let insert = "";
|
|
234
|
+
const lineIndentMatch = /^[\s\d.)\-+*>]*/.exec(line.text);
|
|
235
|
+
const lineIndentLen = lineIndentMatch ? lineIndentMatch[0].length : 0;
|
|
236
|
+
if (!continued || lineIndentLen >= inner.to) {
|
|
237
|
+
for (let i = 0; i < context.length; i++) {
|
|
238
|
+
const c = context[i];
|
|
239
|
+
if (i === context.length - 1 && !continued) {
|
|
240
|
+
console.log("m", doc);
|
|
241
|
+
insert += c.marker(doc, 1);
|
|
242
|
+
} else {
|
|
243
|
+
const maxWidth = i < context.length - 1 ? countColumn(line.text, 4, context[i + 1].from) - insert.length : null;
|
|
244
|
+
insert += c.blank(maxWidth);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
let from = pos;
|
|
249
|
+
while (from > line.from && /\s/.test(line.text.charAt(from - line.from - 1))) {
|
|
250
|
+
from--;
|
|
251
|
+
}
|
|
252
|
+
insert = normalizeIndent(insert, state);
|
|
253
|
+
if (nonTightList(inner.node, state.doc)) {
|
|
254
|
+
insert = blankLine(context, state, line) + state.lineBreak + insert;
|
|
255
|
+
}
|
|
256
|
+
changes.push({ from, to: pos, insert: state.lineBreak + insert });
|
|
257
|
+
return {
|
|
258
|
+
range: EditorSelection.cursor(from + insert.length + 1),
|
|
259
|
+
changes
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
const insertNewlineContinueMarkup = ({
|
|
263
|
+
state,
|
|
264
|
+
dispatch
|
|
265
|
+
}) => {
|
|
266
|
+
const tree = syntaxTree(state);
|
|
267
|
+
const { doc } = state;
|
|
268
|
+
let fallthrough = false;
|
|
269
|
+
const changes = state.changeByRange((range) => {
|
|
270
|
+
if (!range.empty || !markdownLanguage.isActiveAt(state, range.from)) {
|
|
271
|
+
fallthrough = true;
|
|
272
|
+
return { range };
|
|
273
|
+
}
|
|
274
|
+
const pos = range.from;
|
|
275
|
+
const line = doc.lineAt(pos);
|
|
276
|
+
const context = getContext(tree.resolveInner(pos, -1), doc);
|
|
277
|
+
while (context.length && context[context.length - 1].from > pos - line.from) {
|
|
278
|
+
context.pop();
|
|
279
|
+
}
|
|
280
|
+
if (!context.length) {
|
|
281
|
+
fallthrough = true;
|
|
282
|
+
return { range };
|
|
283
|
+
}
|
|
284
|
+
const inner = context[context.length - 1];
|
|
285
|
+
if (inner.to - inner.spaceAfter.length > pos - line.from) {
|
|
286
|
+
fallthrough = true;
|
|
287
|
+
return { range };
|
|
288
|
+
}
|
|
289
|
+
const isAtEndOfMarkup = pos >= inner.to - inner.spaceAfter.length;
|
|
290
|
+
const isLineEmptyAfterMarkup = !/\S/.test(
|
|
291
|
+
line.text.slice(inner.to - (line.from + inner.from))
|
|
292
|
+
);
|
|
293
|
+
if (isAtEndOfMarkup && isLineEmptyAfterMarkup) {
|
|
294
|
+
const emptyLineInListResult = handleEmptyLineInList(
|
|
295
|
+
state,
|
|
296
|
+
context,
|
|
297
|
+
inner,
|
|
298
|
+
pos,
|
|
299
|
+
line
|
|
300
|
+
);
|
|
301
|
+
if (emptyLineInListResult) {
|
|
302
|
+
return emptyLineInListResult;
|
|
303
|
+
}
|
|
304
|
+
const emptyBlockquoteResult = handleEmptyBlockquote(state, inner, line);
|
|
305
|
+
if (emptyBlockquoteResult) {
|
|
306
|
+
return emptyBlockquoteResult;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return continueMarkup(state, context, inner, pos, line);
|
|
310
|
+
});
|
|
311
|
+
if (fallthrough || changes.changes.empty) {
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
dispatch(state.update(changes, { scrollIntoView: true, userEvent: "input" }));
|
|
315
|
+
return true;
|
|
316
|
+
};
|
|
317
|
+
function nonTightList(node, doc) {
|
|
318
|
+
if (node.name !== "OrderedList" && node.name !== "BulletList") {
|
|
319
|
+
return false;
|
|
320
|
+
}
|
|
321
|
+
const first = node.firstChild;
|
|
322
|
+
const second = node.getChild("ListItem", "ListItem");
|
|
323
|
+
if (!first || !second) {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
const line1 = doc.lineAt(first.to);
|
|
327
|
+
const line2 = doc.lineAt(second.from);
|
|
328
|
+
const empty = /^[\s>]*$/.test(line1.text);
|
|
329
|
+
return line1.number + (empty ? 0 : 1) < line2.number;
|
|
330
|
+
}
|
|
331
|
+
function blankLine(context, state, line) {
|
|
332
|
+
let insert = "";
|
|
333
|
+
for (let i = 0; i < context.length - 1; i++) {
|
|
334
|
+
const c = context[i];
|
|
335
|
+
const next = context[i + 1];
|
|
336
|
+
const maxWidth = countColumn(line.text, 4, next.from) - insert.length;
|
|
337
|
+
insert += c.blank(maxWidth, true);
|
|
338
|
+
}
|
|
339
|
+
return normalizeIndent(insert, state);
|
|
340
|
+
}
|
|
341
|
+
function contextNodeForDelete(tree, pos) {
|
|
342
|
+
let node = tree.resolveInner(pos, -1);
|
|
343
|
+
let scan = pos;
|
|
344
|
+
const isMark = (n) => n.name === "QuoteMark" || n.name === "ListMark";
|
|
345
|
+
if (isMark(node) && node.parent) {
|
|
346
|
+
scan = node.from;
|
|
347
|
+
node = node.parent;
|
|
348
|
+
}
|
|
349
|
+
while (true) {
|
|
350
|
+
const prev = node.childBefore(scan);
|
|
351
|
+
if (!prev) {
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
if (isMark(prev)) {
|
|
355
|
+
scan = prev.from;
|
|
356
|
+
} else if ((prev.name === "OrderedList" || prev.name === "BulletList") && prev.lastChild) {
|
|
357
|
+
node = prev.lastChild;
|
|
358
|
+
scan = node.to;
|
|
359
|
+
} else {
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return node;
|
|
364
|
+
}
|
|
365
|
+
const deleteMarkupBackward = ({ state, dispatch }) => {
|
|
366
|
+
const tree = syntaxTree(state);
|
|
367
|
+
let fallthrough = false;
|
|
368
|
+
const changes = state.changeByRange((range) => {
|
|
369
|
+
const { from: pos, to } = range;
|
|
370
|
+
if (to !== pos || !markdownLanguage.isActiveAt(state, pos)) {
|
|
371
|
+
fallthrough = true;
|
|
372
|
+
return { range };
|
|
373
|
+
}
|
|
374
|
+
const line = state.doc.lineAt(pos);
|
|
375
|
+
const context = getContext(contextNodeForDelete(tree, pos), state.doc);
|
|
376
|
+
if (!context.length) {
|
|
377
|
+
fallthrough = true;
|
|
378
|
+
return { range };
|
|
379
|
+
}
|
|
380
|
+
const inner = context[context.length - 1];
|
|
381
|
+
const spaceEnd = inner.to - inner.spaceAfter.length + (inner.spaceAfter ? 1 : 0);
|
|
382
|
+
if (pos - line.from > spaceEnd && !/\S/.test(line.text.slice(spaceEnd, pos - line.from))) {
|
|
383
|
+
const targetPos = line.from + spaceEnd;
|
|
384
|
+
return {
|
|
385
|
+
range: EditorSelection.cursor(targetPos),
|
|
386
|
+
changes: { from: targetPos, to: pos }
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
const isOnSyntaxLine = !inner.item || line.from <= inner.item.from || !/\S/.test(line.text.slice(0, inner.to));
|
|
390
|
+
if (pos - line.from === spaceEnd && isOnSyntaxLine) {
|
|
391
|
+
const start = line.from + inner.from;
|
|
392
|
+
if (inner.item && inner.node.from < inner.item.from && /\S/.test(line.text.slice(inner.from, inner.to))) {
|
|
393
|
+
let insert = inner.blank(
|
|
394
|
+
countColumn(line.text, 4, inner.to) - countColumn(line.text, 4, inner.from)
|
|
395
|
+
);
|
|
396
|
+
if (start === line.from) {
|
|
397
|
+
insert = normalizeIndent(insert, state);
|
|
398
|
+
}
|
|
399
|
+
return {
|
|
400
|
+
range: EditorSelection.cursor(start + insert.length),
|
|
401
|
+
changes: { from: start, to: line.from + inner.to, insert }
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
if (start < pos) {
|
|
405
|
+
return {
|
|
406
|
+
range: EditorSelection.cursor(start),
|
|
407
|
+
changes: { from: start, to: pos }
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
fallthrough = true;
|
|
412
|
+
return { range };
|
|
413
|
+
});
|
|
414
|
+
if (fallthrough || changes.changes.empty) {
|
|
415
|
+
return false;
|
|
416
|
+
}
|
|
417
|
+
dispatch(
|
|
418
|
+
state.update(changes, { scrollIntoView: true, userEvent: "delete" })
|
|
419
|
+
);
|
|
420
|
+
return true;
|
|
421
|
+
};
|
|
422
|
+
const insertFourSpaces = ({ state, dispatch }) => {
|
|
423
|
+
if (!state.selection.main.empty) {
|
|
424
|
+
return false;
|
|
425
|
+
}
|
|
426
|
+
dispatch(
|
|
427
|
+
state.update(
|
|
428
|
+
{
|
|
429
|
+
changes: { from: state.selection.main.head, insert: " " },
|
|
430
|
+
// 插入后,将光标移动到空格后面
|
|
431
|
+
selection: EditorSelection.cursor(state.selection.main.head + 2)
|
|
432
|
+
},
|
|
433
|
+
{ userEvent: "input" }
|
|
434
|
+
)
|
|
435
|
+
);
|
|
436
|
+
return true;
|
|
437
|
+
};
|
|
438
|
+
export {
|
|
439
|
+
deleteMarkupBackward,
|
|
440
|
+
insertFourSpaces,
|
|
441
|
+
insertNewlineContinueMarkup
|
|
442
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useLayoutEffect } from "react";
|
|
2
|
+
import { useInjector } from "@coze-editor/editor/react";
|
|
3
|
+
import { languageSupport } from "@coze-editor/editor/preset-prompt";
|
|
4
|
+
function LanguageSupport() {
|
|
5
|
+
const injector = useInjector();
|
|
6
|
+
useLayoutEffect(() => injector.inject([languageSupport]), [injector]);
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
var language_support_default = LanguageSupport;
|
|
10
|
+
export {
|
|
11
|
+
language_support_default as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useLayoutEffect } from "react";
|
|
2
|
+
import { useInjector } from "@coze-editor/editor/react";
|
|
3
|
+
import { astDecorator } from "@coze-editor/editor";
|
|
4
|
+
import { EditorView } from "@codemirror/view";
|
|
5
|
+
function MarkdownHighlight() {
|
|
6
|
+
const injector = useInjector();
|
|
7
|
+
useLayoutEffect(
|
|
8
|
+
() => injector.inject([
|
|
9
|
+
astDecorator.whole.of((cursor) => {
|
|
10
|
+
if (cursor.name.startsWith("ATXHeading")) {
|
|
11
|
+
return {
|
|
12
|
+
type: "className",
|
|
13
|
+
className: "heading"
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
if (cursor.name === "Emphasis") {
|
|
17
|
+
return {
|
|
18
|
+
type: "className",
|
|
19
|
+
className: "emphasis"
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
if (cursor.name === "StrongEmphasis") {
|
|
23
|
+
return {
|
|
24
|
+
type: "className",
|
|
25
|
+
className: "strong-emphasis"
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (cursor.name === "ListMark" || cursor.name === "QuoteMark") {
|
|
29
|
+
return {
|
|
30
|
+
type: "className",
|
|
31
|
+
className: "mark"
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}),
|
|
35
|
+
EditorView.theme({
|
|
36
|
+
".heading": {
|
|
37
|
+
color: "#00818C",
|
|
38
|
+
fontWeight: "bold"
|
|
39
|
+
},
|
|
40
|
+
".emphasis": {
|
|
41
|
+
fontStyle: "italic"
|
|
42
|
+
},
|
|
43
|
+
".strong-emphasis": {
|
|
44
|
+
fontWeight: "bold"
|
|
45
|
+
},
|
|
46
|
+
".mark": {
|
|
47
|
+
color: "#4E40E5"
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
]),
|
|
51
|
+
[injector]
|
|
52
|
+
);
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
var markdown_default = MarkdownHighlight;
|
|
56
|
+
export {
|
|
57
|
+
markdown_default as default
|
|
58
|
+
};
|