@opengis/cms 0.0.52 → 0.0.54
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/{ArticlesPage-Cddv2qte.js → ArticlesPage-Cuit_90w.js} +5 -5
- package/dist/{BuilderPage-BgcBJcw7.js → BuilderPage-B79YHrmr.js} +139 -139
- package/dist/{CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-C-k8QGA-.js → CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-B6irHMzL.js} +19 -19
- package/dist/{CollectionsPage-d5MLIIAG.js → CollectionsPage-JfmrHNR_.js} +3 -3
- package/dist/{CreateForm-B0srHu5e.js → CreateForm-BMOBeP4G.js} +2 -2
- package/dist/{EditCollectionPage-NUVatLkY.js → EditCollectionPage-CAVLcvLg.js} +5 -5
- package/dist/{EmptyData-BSW20VKP.js → EmptyData-DaZt_nAm.js} +5 -5
- package/dist/{MenuAddPage-Cn3JN04F.js → MenuAddPage-CmU4kAUM.js} +3 -3
- package/dist/{MenuItemPage-B0Th9EOe.js → MenuItemPage-UV8JlJvT.js} +60 -60
- package/dist/{MenuPage-DQpD3IXx.js → MenuPage-c4TPJgIN.js} +4 -4
- package/dist/MonacoEditor.vue_vue_type_script_setup_true_lang-C8cip9Ci.js +84 -0
- package/dist/{UniversalTable.vue_vue_type_script_setup_true_lang-DW6O-xoY.js → UniversalTable.vue_vue_type_script_setup_true_lang-DR4PQwqR.js} +78 -78
- package/dist/{UniversalTablePagination.vue_vue_type_script_setup_true_lang-DBIPBmpm.js → UniversalTablePagination.vue_vue_type_script_setup_true_lang-C8P9DCeX.js} +46 -46
- package/dist/{contentForm-C4Jp-FbQ.js → contentForm-BQdeYVFh.js} +3 -3
- package/dist/{getField-CKcz_b0t.js → getField-Y5WXnRR0.js} +632 -631
- package/dist/index.js +10 -10
- package/dist/style.css +1 -1
- package/dist/{vuedraggable-mqqAYsch.js → vuedraggable-CoAPPFYd.js} +107 -107
- package/package.json +67 -67
- package/server/functions/getTags.js +30 -0
- package/server/routes/cms/controllers/listMedia.js +5 -1
- package/server/routes/cms/controllers/translate.js +3 -3
- package/server/routes/cms/utils/insertContentLocalization.js +22 -4
- package/server/routes/contentType/controllers/getContentType.js +9 -2
- package/server/routes/tags/controllers/get.tags.js +1 -1
- package/utils.js +1 -0
- package/dist/MonacoEditor.vue_vue_type_script_setup_true_lang-CTKNG0qR.js +0 -84
package/package.json
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@opengis/cms",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "cms",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"author": "Softpro",
|
|
7
|
-
"main": "./dist/index.js",
|
|
8
|
-
"license": "EULA",
|
|
9
|
-
"files": [
|
|
10
|
-
"module",
|
|
11
|
-
"locales",
|
|
12
|
-
"dist",
|
|
13
|
-
"server",
|
|
14
|
-
"plugin.js",
|
|
15
|
-
"utils.js",
|
|
16
|
-
"utils.d.ts",
|
|
17
|
-
"input-types.json"
|
|
18
|
-
],
|
|
19
|
-
"scripts": {
|
|
20
|
-
"patch": "npm version patch && git push && npm publish",
|
|
21
|
-
"test": "node --test test/**/*.test.js",
|
|
22
|
-
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
|
23
|
-
"dev": "NODE_ENV=dev bun --env-file=.env.ip server ",
|
|
24
|
-
"admin": "vite admin",
|
|
25
|
-
"build": "vite build && vite build admin",
|
|
26
|
-
"build:lib": "vite build",
|
|
27
|
-
"proxy": "vite dev admin",
|
|
28
|
-
"start": "bun --env-file=.env.ip server",
|
|
29
|
-
"prod": "NODE_ENV=production bun --env-file=.env.ip server ",
|
|
30
|
-
"ip": "bun --env-file=.env.ip server",
|
|
31
|
-
"demo": "node --env-file=.env.demo --env-file=.env server",
|
|
32
|
-
"i18n:sync": "node i18n-sync.cjs",
|
|
33
|
-
"prepublishOnly": "bun build:lib",
|
|
34
|
-
"softpro": "bun --env-file=.env.softpro server",
|
|
35
|
-
"softpro1": "NODE_ENV=production bun --env-file=.env.prod-softpro.local server"
|
|
36
|
-
},
|
|
37
|
-
"dependencies": {},
|
|
38
|
-
"resolutions": {
|
|
39
|
-
"rollup": "4.30.0"
|
|
40
|
-
},
|
|
41
|
-
"devDependencies": {
|
|
42
|
-
"@fastify/compress": "^8.1.0",
|
|
43
|
-
"@opengis/core": "^0.0.30",
|
|
44
|
-
"@opengis/fastify-table": "^2.0.143",
|
|
45
|
-
"@opengis/filter": "^0.1.31",
|
|
46
|
-
"@opengis/form": "^0.0.109",
|
|
47
|
-
"@opengis/richtext": "0.0.45",
|
|
48
|
-
"@vueuse/head": "2.0.0",
|
|
49
|
-
"js-yaml": "^4.1.0",
|
|
50
|
-
"lucide-vue-next": "0.344.0",
|
|
51
|
-
"vite": "5.1.4",
|
|
52
|
-
"vue": "^3.5.17",
|
|
53
|
-
"vue-i18n": "11.1.5",
|
|
54
|
-
"vue-router": "4.4.3",
|
|
55
|
-
"vuedraggable": "4.1.0",
|
|
56
|
-
"@tailwindcss/typography": "0.5.10",
|
|
57
|
-
"@tsconfig/node22": "^22.0.2",
|
|
58
|
-
"@vitejs/plugin-vue": "5.0.4",
|
|
59
|
-
"autoprefixer": "10.4.18",
|
|
60
|
-
"eslint": "8.49.0",
|
|
61
|
-
"postcss": "8.4.35",
|
|
62
|
-
"sass": "^1.92.1",
|
|
63
|
-
"tailwindcss": "3.4.1",
|
|
64
|
-
"typescript": "~5.8.0",
|
|
65
|
-
"vitest": "3.2.4",
|
|
66
|
-
"vue-tsc": "^2.2.10"
|
|
67
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@opengis/cms",
|
|
3
|
+
"version": "0.0.54",
|
|
4
|
+
"description": "cms",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"author": "Softpro",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"license": "EULA",
|
|
9
|
+
"files": [
|
|
10
|
+
"module",
|
|
11
|
+
"locales",
|
|
12
|
+
"dist",
|
|
13
|
+
"server",
|
|
14
|
+
"plugin.js",
|
|
15
|
+
"utils.js",
|
|
16
|
+
"utils.d.ts",
|
|
17
|
+
"input-types.json"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"patch": "npm version patch && git push && npm publish",
|
|
21
|
+
"test": "node --test test/**/*.test.js",
|
|
22
|
+
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
|
23
|
+
"dev": "NODE_ENV=dev bun --env-file=.env.ip server ",
|
|
24
|
+
"admin": "vite admin",
|
|
25
|
+
"build": "vite build && vite build admin",
|
|
26
|
+
"build:lib": "vite build",
|
|
27
|
+
"proxy": "vite dev admin",
|
|
28
|
+
"start": "bun --env-file=.env.ip server",
|
|
29
|
+
"prod": "NODE_ENV=production bun --env-file=.env.ip server ",
|
|
30
|
+
"ip": "bun --env-file=.env.ip server",
|
|
31
|
+
"demo": "node --env-file=.env.demo --env-file=.env server",
|
|
32
|
+
"i18n:sync": "node i18n-sync.cjs",
|
|
33
|
+
"prepublishOnly": "bun build:lib",
|
|
34
|
+
"softpro": "bun --env-file=.env.softpro server",
|
|
35
|
+
"softpro1": "NODE_ENV=production bun --env-file=.env.prod-softpro.local server"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {},
|
|
38
|
+
"resolutions": {
|
|
39
|
+
"rollup": "4.30.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@fastify/compress": "^8.1.0",
|
|
43
|
+
"@opengis/core": "^0.0.30",
|
|
44
|
+
"@opengis/fastify-table": "^2.0.143",
|
|
45
|
+
"@opengis/filter": "^0.1.31",
|
|
46
|
+
"@opengis/form": "^0.0.109",
|
|
47
|
+
"@opengis/richtext": "0.0.45",
|
|
48
|
+
"@vueuse/head": "2.0.0",
|
|
49
|
+
"js-yaml": "^4.1.0",
|
|
50
|
+
"lucide-vue-next": "0.344.0",
|
|
51
|
+
"vite": "5.1.4",
|
|
52
|
+
"vue": "^3.5.17",
|
|
53
|
+
"vue-i18n": "11.1.5",
|
|
54
|
+
"vue-router": "4.4.3",
|
|
55
|
+
"vuedraggable": "4.1.0",
|
|
56
|
+
"@tailwindcss/typography": "0.5.10",
|
|
57
|
+
"@tsconfig/node22": "^22.0.2",
|
|
58
|
+
"@vitejs/plugin-vue": "5.0.4",
|
|
59
|
+
"autoprefixer": "10.4.18",
|
|
60
|
+
"eslint": "8.49.0",
|
|
61
|
+
"postcss": "8.4.35",
|
|
62
|
+
"sass": "^1.92.1",
|
|
63
|
+
"tailwindcss": "3.4.1",
|
|
64
|
+
"typescript": "~5.8.0",
|
|
65
|
+
"vitest": "3.2.4",
|
|
66
|
+
"vue-tsc": "^2.2.10"
|
|
67
|
+
}
|
|
68
68
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
|
|
3
|
+
import { config, getRedis, pgClients } from '@opengis/fastify-table/utils.js';
|
|
4
|
+
import { createMockReply } from './utils/mock.reply.js';
|
|
5
|
+
|
|
6
|
+
import getTagsApi from '../routes/tags/controllers/get.tags.js';
|
|
7
|
+
|
|
8
|
+
const pg = pgClients.client;
|
|
9
|
+
const rclient = getRedis();
|
|
10
|
+
|
|
11
|
+
export default async function getTags({ page = 1, limit = 16, search, ttl = 3600 } = {}) {
|
|
12
|
+
|
|
13
|
+
const crudInc = await rclient.get(`pg:site.contents:tags`) || 0;
|
|
14
|
+
|
|
15
|
+
const cacheKey = createHash('md5').update([config.pg?.database, 'cms:tags', crudInc, page, limit, search].join(':')).digest('hex');
|
|
16
|
+
const cacheData = ttl === 0 ? null : JSON.parse(await rclient.get(cacheKey));
|
|
17
|
+
|
|
18
|
+
if (cacheData) {
|
|
19
|
+
return { cache: true, ...cacheData };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const mockReply = createMockReply();
|
|
23
|
+
const result = await getTagsApi({ pg, query: { page, limit, search } }, mockReply);
|
|
24
|
+
|
|
25
|
+
if (ttl) {
|
|
26
|
+
await rclient.set(cacheKey, JSON.stringify(result), 'EX', ttl);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
@@ -82,7 +82,11 @@ export default async function listMedia(req, reply) {
|
|
|
82
82
|
Object.assign(result, { rootDir });
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
// TODO: Фільтрувати по stats.mtime?
|
|
86
|
+
const allowedNames = Boolean(query?.filter) || Boolean(q) ? new Set(rows.map(r => r.filename)) : null;
|
|
87
|
+
const filteredFiles = (search ? allItems.filter(el => el.name.includes(search)) : items)
|
|
88
|
+
.filter(el => el.isFile())
|
|
89
|
+
.filter(el => !allowedNames || allowedNames.has(el.name));
|
|
86
90
|
|
|
87
91
|
const files = await Promise.all(filteredFiles.map(async el => {
|
|
88
92
|
const media = rows.find(row => row.filename === el.name);
|
|
@@ -21,7 +21,7 @@ export async function translateContent({
|
|
|
21
21
|
return reply.status(400).send({ error: 'not enough query params: to', code: 400 });
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const { id, collection = 'pages', from = 'uk', to, nocache } = query;
|
|
24
|
+
const { id, collection = 'pages', from = 'uk', to, nocache, skip } = query;
|
|
25
25
|
const { id: collectionId, table, columns = [] } = await getCollectionId(collection, pg);
|
|
26
26
|
|
|
27
27
|
if (!collectionId) {
|
|
@@ -34,7 +34,7 @@ export async function translateContent({
|
|
|
34
34
|
return reply.status(400).send({ error: 'collection does not contain any fields with localization enabled', code: 400 });
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const result = await insertContentLocalization({ table, id, from, to, nocache, schemaKeys, user }, pg);
|
|
37
|
+
const result = await insertContentLocalization({ table, id, from, to, nocache, skip, schemaKeys, user }, pg);
|
|
38
38
|
|
|
39
39
|
if (result?.error) {
|
|
40
40
|
return reply.status(result.code).send(result);
|
|
@@ -80,7 +80,7 @@ export async function translateCollection({
|
|
|
80
80
|
|
|
81
81
|
send(`target localization already exists for ${ids.length - filteredIds.length}/${ids.length} rows`);
|
|
82
82
|
|
|
83
|
-
await sequence(debug ? filteredIds.slice(0, 1) : filteredIds, { send, pg, from, to, table, nocache: true, schemaKeys, user }, insertContentLocalization);
|
|
83
|
+
await sequence(debug ? filteredIds.slice(0, 1) : filteredIds, { send, pg, from, to, table, nocache: true, skip, schemaKeys, user }, insertContentLocalization);
|
|
84
84
|
return send('translation complete', true);
|
|
85
85
|
} catch (err) {
|
|
86
86
|
return send(err.toString(), true);
|
|
@@ -2,7 +2,7 @@ import { dataInsert, pgClients } from "@opengis/fastify-table/utils.js";
|
|
|
2
2
|
|
|
3
3
|
import requestTranslation from "./requestTranslation.js";
|
|
4
4
|
|
|
5
|
-
export default async function insertContentLocalization({ send = () => { }, table, id, from, to, nocache, schemaKeys, user }, pg = pgClients.client) {
|
|
5
|
+
export default async function insertContentLocalization({ send = () => { }, table, id, from, to, nocache, skip, schemaKeys, user }, pg = pgClients.client) {
|
|
6
6
|
if (!to) {
|
|
7
7
|
const resp = { error: 'not enough query params: to', code: 400 };
|
|
8
8
|
send(resp.error + ': ' + id);
|
|
@@ -17,10 +17,13 @@ export default async function insertContentLocalization({ send = () => { }, tabl
|
|
|
17
17
|
return resp;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
const targetLocalization = await pg.query('select json_object_agg(split_part(field_key,\':\',1),field_value) from site.localization where object_id=$1 and field_key is not null and split_part(field_key,\':\',2)=$2', [row.id, to])
|
|
21
|
+
.then(el => el.rows?.[0]?.json_object_agg);
|
|
22
|
+
|
|
20
23
|
const localizationExists = await pg.query('select 1 from site.localization where object_id=$1 and field_key is not null and split_part(field_key,\':\',2)=$2', [row.id, to])
|
|
21
24
|
.then(el => el.rowCount);
|
|
22
25
|
|
|
23
|
-
if (localizationExists && !nocache) {
|
|
26
|
+
if (localizationExists && !nocache && !skip) {
|
|
24
27
|
const resp = { error: 'target localization already exists', code: 400 };
|
|
25
28
|
send(resp.error + ': ' + id);
|
|
26
29
|
return resp;
|
|
@@ -38,9 +41,18 @@ export default async function insertContentLocalization({ send = () => { }, tabl
|
|
|
38
41
|
const obj = { ...row, ...localization };
|
|
39
42
|
|
|
40
43
|
const entries = Object.entries(obj).filter(([key, value]) => value && schemaKeys.includes(key) && (typeof value === 'string' || (Array.isArray(value) && value?.[0] && typeof value?.[0] === 'object' && Object.keys(value).length)));
|
|
41
|
-
|
|
44
|
+
// do not old localization overwrite by default
|
|
45
|
+
const filteredEntries = skip && targetLocalization ? entries.filter(([key]) => !Object.keys(targetLocalization).includes(key)) : entries;
|
|
46
|
+
|
|
47
|
+
if (skip && targetLocalization && !filteredEntries.length) {
|
|
48
|
+
const resp = { error: 'nothing to localize after skipping of fields with existing localization', code: 400 };
|
|
49
|
+
send(resp.error + ': ' + id);
|
|
50
|
+
return resp;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const skipped = schemaKeys.filter(key => !filteredEntries.map(([el]) => el).includes(key));
|
|
42
54
|
|
|
43
|
-
const { result, error, code = 200 } = await requestTranslation(
|
|
55
|
+
const { result, error, code = 200 } = await requestTranslation(filteredEntries, from, to);
|
|
44
56
|
|
|
45
57
|
if (error && code) {
|
|
46
58
|
send(error + ': ' + id);
|
|
@@ -67,6 +79,12 @@ export default async function insertContentLocalization({ send = () => { }, tabl
|
|
|
67
79
|
console.log('deleted existing localizations: ', deleted, id);
|
|
68
80
|
}
|
|
69
81
|
|
|
82
|
+
if (skip) {
|
|
83
|
+
const deleted = await client.query('delete from site.localization where object_id=$1 and not split_part(field_key,\':\',1)<>any($2)', [id, Object.keys(targetLocalization)]).then(el => el.rowCount || 0);
|
|
84
|
+
send(`deleted existing localizations1: ${deleted}, ${id}`);
|
|
85
|
+
console.log('deleted existing localizations1: ', deleted, id);
|
|
86
|
+
}
|
|
87
|
+
|
|
70
88
|
await Promise.all(arr.map(async row => dataInsert({
|
|
71
89
|
pg: client,
|
|
72
90
|
table: 'site.localization',
|
|
@@ -23,9 +23,16 @@ export default async function builderGet({ pg = pgClients.client, params = {} },
|
|
|
23
23
|
).then(el => el.rows?.[0] || {});
|
|
24
24
|
Object.assign(row, { space });
|
|
25
25
|
|
|
26
|
-
const loadTable = params.id === 'pages' ? await getTemplate('table', 'single.default.table') : {};
|
|
26
|
+
// const loadTable = params.id === 'pages' ? await getTemplate('table', 'single.default.table') : {};
|
|
27
|
+
// const columns = params.id === 'pages' ? loadTable?.columns : row.columns;
|
|
28
|
+
|
|
29
|
+
const loadTable = params.id === 'pages'
|
|
30
|
+
? await getTemplate('table', 'single.default.table')
|
|
31
|
+
: await getTemplate('table', 'collection.default.table');
|
|
32
|
+
const { columns: defaultColumns = [] } = loadTable || {};
|
|
33
|
+
defaultColumns.forEach(col => Object.assign(col, { default: true }));
|
|
34
|
+
const columns = (defaultColumns || []).concat(row.columns.filter(col => !defaultColumns.map(el => el.name).includes(col.name)));
|
|
27
35
|
|
|
28
|
-
const columns = params.id === 'pages' ? loadTable?.columns : row.columns;
|
|
29
36
|
Object.assign(row, { columns });
|
|
30
37
|
|
|
31
38
|
// filter system / hidden
|
|
@@ -11,6 +11,6 @@ export default async function getTags(req, reply) {
|
|
|
11
11
|
|
|
12
12
|
const { rows } = await pg.query(selectSql);
|
|
13
13
|
|
|
14
|
-
return reply.
|
|
14
|
+
return reply.status(200).send({ message: { total, filtered, rows }, status: 200 })
|
|
15
15
|
|
|
16
16
|
}
|
package/utils.js
CHANGED
|
@@ -3,5 +3,6 @@ export { default as getContent } from "./server/functions/getContent.js";
|
|
|
3
3
|
export { default as getSettings } from "./server/routes/cms/functions/getSettings.js";
|
|
4
4
|
export { default as getUser } from "./server/functions/getUser.js";
|
|
5
5
|
export { default as getSearchData } from "./server/functions/getSearchData.js";
|
|
6
|
+
export { default as getTags } from "./server/functions/getTags.js";
|
|
6
7
|
|
|
7
8
|
export default null;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { defineComponent as s, mergeModels as c, useModel as m, ref as f, onMounted as h, watch as d, onBeforeUnmount as g, createElementBlock as p, openBlock as v, normalizeStyle as w } from "vue";
|
|
2
|
-
async function M() {
|
|
3
|
-
if (window.monaco)
|
|
4
|
-
return window.monaco;
|
|
5
|
-
const a = "https://cdn.jsdelivr.net/npm/monaco-editor@0.45.0/min";
|
|
6
|
-
return window.require || (window.require = { paths: { vs: `${a}/vs` } }, await new Promise((o, l) => {
|
|
7
|
-
const n = document.createElement("script");
|
|
8
|
-
n.src = `${a}/vs/loader.min.js`, n.onload = () => o(), n.onerror = l, document.head.appendChild(n);
|
|
9
|
-
})), new Promise((o) => {
|
|
10
|
-
window.require(["vs/editor/editor.main"], () => o(window.monaco));
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
const C = /* @__PURE__ */ s({
|
|
14
|
-
__name: "MonacoEditor",
|
|
15
|
-
props: /* @__PURE__ */ c({
|
|
16
|
-
language: { default: "javascript" },
|
|
17
|
-
theme: { default: "vs-dark" },
|
|
18
|
-
width: { default: "100%" },
|
|
19
|
-
height: { default: "100%" },
|
|
20
|
-
options: { default: () => ({
|
|
21
|
-
minimap: { enabled: !1 }
|
|
22
|
-
}) }
|
|
23
|
-
}, {
|
|
24
|
-
modelValue: {
|
|
25
|
-
required: !0
|
|
26
|
-
},
|
|
27
|
-
modelModifiers: {}
|
|
28
|
-
}),
|
|
29
|
-
emits: ["update:modelValue"],
|
|
30
|
-
setup(a) {
|
|
31
|
-
const o = a, l = m(a, "modelValue"), n = f(null);
|
|
32
|
-
let e = null, i = null;
|
|
33
|
-
return h(async () => {
|
|
34
|
-
var t;
|
|
35
|
-
if (n.value)
|
|
36
|
-
try {
|
|
37
|
-
i = await M();
|
|
38
|
-
const r = ((t = l.value) == null ? void 0 : t.replace(/\\n/g, `
|
|
39
|
-
`)) || "";
|
|
40
|
-
e = i.editor.create(n.value, {
|
|
41
|
-
value: r,
|
|
42
|
-
language: o.language,
|
|
43
|
-
theme: o.theme,
|
|
44
|
-
automaticLayout: !0,
|
|
45
|
-
...o.options
|
|
46
|
-
}), e.onDidChangeModelContent(() => {
|
|
47
|
-
const u = (e == null ? void 0 : e.getValue()) || "";
|
|
48
|
-
l.value = u;
|
|
49
|
-
});
|
|
50
|
-
} catch (r) {
|
|
51
|
-
console.error("Failed to load Monaco Editor:", r);
|
|
52
|
-
}
|
|
53
|
-
}), d(
|
|
54
|
-
() => l.value,
|
|
55
|
-
(t) => {
|
|
56
|
-
if (e) {
|
|
57
|
-
const r = (t == null ? void 0 : t.replace(/\\n/g, `
|
|
58
|
-
`)) || "";
|
|
59
|
-
r !== e.getValue() && e.setValue(r);
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
{ immediate: !0 }
|
|
63
|
-
), d(
|
|
64
|
-
() => o.language,
|
|
65
|
-
(t) => {
|
|
66
|
-
e && t && i && i.editor.setModelLanguage(e.getModel(), t);
|
|
67
|
-
}
|
|
68
|
-
), d(
|
|
69
|
-
() => o.theme,
|
|
70
|
-
(t) => {
|
|
71
|
-
e && t && i && i.editor.setTheme(t);
|
|
72
|
-
}
|
|
73
|
-
), g(() => {
|
|
74
|
-
e && (e.dispose(), e = null);
|
|
75
|
-
}), (t, r) => (v(), p("div", {
|
|
76
|
-
ref_key: "editorContainer",
|
|
77
|
-
ref: n,
|
|
78
|
-
style: w({ width: a.width, height: a.height })
|
|
79
|
-
}, null, 4));
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
export {
|
|
83
|
-
C as _
|
|
84
|
-
};
|