@silexlabs/silex 3.0.0-alpha.71 → 3.0.0-alpha.73
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/.silex.js +4 -0
- package/dist/client/css/admin.css +5 -2
- package/dist/client/js/main.js +6 -6
- package/dist/plugins/client/client/grapesjs/PublicationUi.js +3 -3
- package/dist/plugins/client/client/grapesjs/PublicationUi.js.map +1 -1
- package/dist/plugins/client/client/grapesjs/index.js +0 -5
- package/dist/plugins/client/client/grapesjs/index.js.map +1 -1
- package/dist/plugins/client/client/grapesjs/storage.js +25 -31
- package/dist/plugins/client/client/grapesjs/storage.js.map +1 -1
- package/dist/plugins/client/client/grapesjs/symbolDialogs.js +1 -1
- package/dist/plugins/client/client/grapesjs/symbolDialogs.js.map +1 -1
- package/dist/plugins/client/client/publication-transformers.js +0 -4
- package/dist/plugins/client/client/publication-transformers.js.map +1 -1
- package/dist/plugins/client/plugins/client/11ty.js.map +1 -1
- package/dist/plugins/server/plugins/server/AuthPlugin.js +2 -0
- package/dist/plugins/server/plugins/server/AuthPlugin.js.map +1 -1
- package/dist/plugins/server/plugins/server/DownloadConnector.js.map +1 -1
- package/dist/plugins/server/server/connectors/connectors.d.ts +1 -1
- package/dist/plugins/server/server/events.js.map +1 -1
- package/dist/server/server/api/connectorApi.js +1 -1
- package/dist/server/server/api/websiteApi.js +7 -5
- package/package.json +1 -3
- package/public/silex.js +4 -50
- package/src/css/silex.scss +3 -0
- package/src/ts/client/grapesjs/PublicationUi.ts +3 -3
- package/src/ts/client/grapesjs/index.ts +0 -5
- package/src/ts/client/grapesjs/storage.ts +20 -25
- package/src/ts/client/grapesjs/symbolDialogs.ts +1 -1
- package/src/ts/client/publication-transformers.ts +0 -5
- package/src/ts/plugins/client/11ty.ts +0 -1
- package/src/ts/plugins/server/AuthPlugin.ts +2 -2
- package/src/ts/plugins/server/DownloadConnector.ts +0 -2
- package/src/ts/server/api/connectorApi.ts +1 -1
- package/src/ts/server/api/websiteApi.ts +10 -5
- package/src/ts/server/connectors/connectors.ts +1 -1
- package/src/ts/server/events.ts +0 -1
- package/dist/plugins/server/server/api/publicationApi.d.ts +0 -23
- package/dist/plugins/server/server/api/publicationApi.js +0 -148
- package/dist/plugins/server/server/api/publicationApi.js.map +0 -1
- package/src/example-client-config.js +0 -64
|
@@ -31,7 +31,7 @@ export default grapesjs.plugins.add(name, (editor, opts) => {
|
|
|
31
31
|
editor.Commands.add(cmdPromptAddSymbol, {
|
|
32
32
|
run: (_, sender) => {
|
|
33
33
|
const label = prompt('Label', getNext('Symbol '))
|
|
34
|
-
const icon =
|
|
34
|
+
const icon = 'fa-gem'
|
|
35
35
|
editor.runCommand(cmdAddSymbol, { label, icon })
|
|
36
36
|
}
|
|
37
37
|
})
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
import { Component, CssRule, Editor, ObjectStrings, Page } from 'grapesjs'
|
|
19
19
|
import { ClientSideFile, ClientSideFileType, ClientSideFileWithPermalink, PublicationData } from '../types'
|
|
20
20
|
import { onAll } from './utils'
|
|
21
|
-
import { getPageLink, getPageSlug } from '../page'
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* @fileoverview Silex publication transformers are used to control how the site is rendered and published
|
|
@@ -95,15 +94,11 @@ export function renderComponents(editor: Editor) {
|
|
|
95
94
|
c[ATTRIBUTE_METHOD_STORE_INLINE_CSS] = c.getStyle
|
|
96
95
|
const href = c.get('attributes').href as string | undefined
|
|
97
96
|
if(href?.startsWith('./')) {
|
|
98
|
-
//const page = editor.Pages.getAll().find(p => getPageLink(p.getName()) === href)
|
|
99
|
-
//if(page) {
|
|
100
97
|
c[ATTRIBUTE_METHOD_STORE_HREF] = href
|
|
101
98
|
c.set('attributes', {
|
|
102
99
|
...c.get('attributes'),
|
|
103
|
-
//href: transformPagePermalin(editor, page),
|
|
104
100
|
href: transformPermalink(editor, href, ClientSideFileType.HTML),
|
|
105
101
|
})
|
|
106
|
-
//}
|
|
107
102
|
}
|
|
108
103
|
// Handle both c.attributes.src and c.attributes.attributes.src
|
|
109
104
|
// For some reason we need both
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import express from 'express'
|
|
19
|
-
import { Directus } from '@directus/sdk'
|
|
18
|
+
// import express from 'express'
|
|
19
|
+
// import { Directus } from '@directus/sdk'
|
|
20
20
|
|
|
21
21
|
export default async function(config, opts = {}) {
|
|
22
22
|
// config.on('silex:startup:start', ({app}) => {
|
|
@@ -4,10 +4,8 @@ import { ConnectorOptions, ConnectorType, ConnectorUser, JobData, JobStatus, Pub
|
|
|
4
4
|
import { ConnectorFile, ConnectorSession, HostingConnector } from '../../server/connectors/connectors'
|
|
5
5
|
import { tmpdir } from 'os'
|
|
6
6
|
import { JobManager } from '../../server/jobs'
|
|
7
|
-
import { Readable } from 'stream'
|
|
8
7
|
import { ServerConfig } from '../../server/config'
|
|
9
8
|
import { ServerEvent } from '../../server/events'
|
|
10
|
-
import { getHostingConnector } from '../../server/api/publicationApi'
|
|
11
9
|
|
|
12
10
|
import { Request, Response } from 'express'
|
|
13
11
|
|
|
@@ -96,7 +96,7 @@ async function routeUser(req: Request, res: Response) {
|
|
|
96
96
|
const user = await connector.getUser(session)
|
|
97
97
|
res.json(user as ApiConnectorUserResponse)
|
|
98
98
|
} catch (error) {
|
|
99
|
-
console.error('Error in the
|
|
99
|
+
console.error('Error in the user request', error, error.code)
|
|
100
100
|
res.status(validateStatus(error?.code ?? error?.httpStatusCode, 500)).json({
|
|
101
101
|
error: true,
|
|
102
102
|
message: error.message,
|
|
@@ -293,14 +293,14 @@ export default function (config: ServerConfig, opts = {}): Router {
|
|
|
293
293
|
config.emit(ServerEvent.WEBSITE_ASSET_STORE_START, { files, websiteId, connectorId } as WebsiteAssetStoreStartEventType)
|
|
294
294
|
|
|
295
295
|
// Write the files
|
|
296
|
-
await writeAssets(req['session'], websiteId, files, connectorId)
|
|
296
|
+
const result = await writeAssets(req['session'], websiteId, files, connectorId)
|
|
297
297
|
|
|
298
298
|
// Return the file URLs to insert in the website
|
|
299
299
|
// As expected by grapesjs (https://grapesjs.com/docs/modules/Assets.html#uploading-assets)
|
|
300
300
|
res.json({
|
|
301
|
-
data:
|
|
301
|
+
data: result.map(path =>
|
|
302
302
|
API_PATH + API_WEBSITE_PATH + API_WEBSITE_ASSET_READ
|
|
303
|
-
+
|
|
303
|
+
+ path
|
|
304
304
|
+ `?websiteId=${websiteId}&connectorId=${connectorId ? connectorId : ''}` // As expected by wesite API (readAsset)
|
|
305
305
|
),
|
|
306
306
|
} as ApiWebsiteAssetsWriteResponse)
|
|
@@ -394,6 +394,7 @@ export default function (config: ServerConfig, opts = {}): Router {
|
|
|
394
394
|
|
|
395
395
|
/**
|
|
396
396
|
* Write an asset to the connector
|
|
397
|
+
* @returns File names on the storage connector, always starting with a slash
|
|
397
398
|
*/
|
|
398
399
|
async function writeAssets(session: any, websiteId: string, files: ConnectorFile[], connectorId?: string): Promise<string[]> {
|
|
399
400
|
// Get the desired connector
|
|
@@ -406,14 +407,18 @@ export default function (config: ServerConfig, opts = {}): Router {
|
|
|
406
407
|
}))
|
|
407
408
|
|
|
408
409
|
// Write the asset to the connector
|
|
409
|
-
await storageConnector.writeAssets(
|
|
410
|
+
const result = await storageConnector.writeAssets(
|
|
410
411
|
session,
|
|
411
412
|
websiteId,
|
|
412
413
|
cleanPathFiles,
|
|
413
414
|
)
|
|
414
415
|
|
|
415
416
|
// Return the files URLs with the website id
|
|
416
|
-
return files.map(({ path }) => `${
|
|
417
|
+
return files.map(({ path }, idx) => `${
|
|
418
|
+
result && result[idx]
|
|
419
|
+
? `/${result[idx].replace(/^\//, '')}` // ensure the leading slash
|
|
420
|
+
: path
|
|
421
|
+
}?websiteId=${websiteId}`)
|
|
417
422
|
}
|
|
418
423
|
return router
|
|
419
424
|
}
|
|
@@ -87,7 +87,7 @@ export interface StorageConnector<Session extends ConnectorSession = ConnectorSe
|
|
|
87
87
|
updateWebsite(session: Session, websiteId: WebsiteId, data: WebsiteData): Promise<void>
|
|
88
88
|
deleteWebsite(session: Session, websiteId: WebsiteId): Promise<void>
|
|
89
89
|
// CRUD on assets
|
|
90
|
-
writeAssets(session: Session, websiteId: WebsiteId, files: ConnectorFile[], status?: StatusCallback): Promise<void>
|
|
90
|
+
writeAssets(session: Session, websiteId: WebsiteId, files: ConnectorFile[], status?: StatusCallback): Promise<string[] | void>
|
|
91
91
|
readAsset(session: Session, websiteId: WebsiteId, fileName: string): Promise<ConnectorFileContent>
|
|
92
92
|
deleteAssets(session: Session, websiteId: WebsiteId, fileNames: string[]): Promise<void>
|
|
93
93
|
//getFileUrl(session: Session, websiteId: WebsiteId, path: string): Promise<string>
|
package/src/ts/server/events.ts
CHANGED
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
// FIXME: this is for client and server, it is confusing, split in 2 files
|
|
19
18
|
import { ConnectorId, PublicationData, WebsiteData, WebsiteId } from '../types'
|
|
20
19
|
import { ConnectorFile } from './connectors/connectors'
|
|
21
20
|
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Router } from 'express';
|
|
2
|
-
import { HostingConnector, StorageConnector } from '../connectors/connectors';
|
|
3
|
-
import { ServerConfig } from '../config';
|
|
4
|
-
/**
|
|
5
|
-
* @fileoverview Publication plugin for Silex
|
|
6
|
-
* Adds a publication API to Silex server
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Error thrown by the publication API
|
|
10
|
-
* @param message error message
|
|
11
|
-
* @param code http status code
|
|
12
|
-
*/
|
|
13
|
-
export declare class PublicationError extends Error {
|
|
14
|
-
code: number;
|
|
15
|
-
constructor(message: string, code: number);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Get the desired connector
|
|
19
|
-
* Can be the default connector or a specific one
|
|
20
|
-
*/
|
|
21
|
-
export declare function getHostingConnector(session: any, config: ServerConfig, connectorId?: string): Promise<HostingConnector>;
|
|
22
|
-
export declare function getStorageConnector(session: any, config: ServerConfig, connectorId?: string): Promise<StorageConnector>;
|
|
23
|
-
export default function (config: ServerConfig): Router;
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Silex website builder, free/libre no-code tool for makers.
|
|
4
|
-
* Copyright (c) 2023 lexoyo and Silex Labs foundation
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU Affero General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.getStorageConnector = exports.getHostingConnector = exports.PublicationError = void 0;
|
|
20
|
-
const express_1 = require("express");
|
|
21
|
-
const constants_1 = require("../../constants");
|
|
22
|
-
const types_1 = require("../../types");
|
|
23
|
-
const connectors_1 = require("../connectors/connectors");
|
|
24
|
-
const validation_1 = require("../utils/validation");
|
|
25
|
-
const events_1 = require("../events");
|
|
26
|
-
const jobs_1 = require("../jobs");
|
|
27
|
-
/**
|
|
28
|
-
* @fileoverview Publication plugin for Silex
|
|
29
|
-
* Adds a publication API to Silex server
|
|
30
|
-
*/
|
|
31
|
-
/**
|
|
32
|
-
* Error thrown by the publication API
|
|
33
|
-
* @param message error message
|
|
34
|
-
* @param code http status code
|
|
35
|
-
*/
|
|
36
|
-
class PublicationError extends Error {
|
|
37
|
-
code;
|
|
38
|
-
constructor(message, code) {
|
|
39
|
-
super(message);
|
|
40
|
-
this.code = code;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.PublicationError = PublicationError;
|
|
44
|
-
const PROJECT_ROOT = require.main ? require.main.path : process.cwd();
|
|
45
|
-
/**
|
|
46
|
-
* Get the desired connector
|
|
47
|
-
* Can be the default connector or a specific one
|
|
48
|
-
*/
|
|
49
|
-
async function getHostingConnector(session, config, connectorId) {
|
|
50
|
-
const hostingConnector = await (0, connectors_1.getConnector)(config, session, types_1.ConnectorType.HOSTING, connectorId); // ?? config.getHostingConnectors()[0]
|
|
51
|
-
if (!hostingConnector) {
|
|
52
|
-
throw new PublicationError('No hosting connector found', 500);
|
|
53
|
-
}
|
|
54
|
-
if (!await hostingConnector.isLoggedIn(session)) {
|
|
55
|
-
throw new PublicationError('Not logged in', 401);
|
|
56
|
-
}
|
|
57
|
-
return hostingConnector;
|
|
58
|
-
}
|
|
59
|
-
exports.getHostingConnector = getHostingConnector;
|
|
60
|
-
async function getStorageConnector(session, config, connectorId) {
|
|
61
|
-
const storageConnector = await (0, connectors_1.getConnector)(config, session, types_1.ConnectorType.STORAGE, connectorId); // ?? config.getStorageConnectors()[0]
|
|
62
|
-
if (!storageConnector) {
|
|
63
|
-
throw new PublicationError('No storage connector found', 500);
|
|
64
|
-
}
|
|
65
|
-
if (!await storageConnector.isLoggedIn(session)) {
|
|
66
|
-
throw new PublicationError('Not logged in to the storage connector', 401);
|
|
67
|
-
}
|
|
68
|
-
return storageConnector;
|
|
69
|
-
}
|
|
70
|
-
exports.getStorageConnector = getStorageConnector;
|
|
71
|
-
function default_1(config) {
|
|
72
|
-
// Create a new router
|
|
73
|
-
const router = (0, express_1.Router)();
|
|
74
|
-
// Get publication status
|
|
75
|
-
router.get(constants_1.API_PUBLICATION_STATUS, async function (req, res) {
|
|
76
|
-
const query = req.query;
|
|
77
|
-
const jobId = query.jobId;
|
|
78
|
-
const job = jobId && (0, jobs_1.getJob)(jobId);
|
|
79
|
-
if (!job) {
|
|
80
|
-
console.error(`Error: job not found with id ${jobId}`);
|
|
81
|
-
res.status(404).json({
|
|
82
|
-
message: 'Error: job not found.',
|
|
83
|
-
});
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
res.json({
|
|
87
|
-
...job,
|
|
88
|
-
_timeout: undefined,
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
// Publish website
|
|
92
|
-
router.post(constants_1.API_PUBLICATION_PUBLISH, async function (req, res) {
|
|
93
|
-
try {
|
|
94
|
-
const query = req.query;
|
|
95
|
-
const body = req.body;
|
|
96
|
-
const websiteId = (0, validation_1.requiredParam)(query.websiteId, 'id in query');
|
|
97
|
-
const storageId = (0, validation_1.requiredParam)(query.storageId, 'storageId in query');
|
|
98
|
-
const hostingId = (0, validation_1.requiredParam)(query.hostingId, 'hostingId in query');
|
|
99
|
-
const session = (0, validation_1.requiredParam)(req['session'], 'session on express request');
|
|
100
|
-
// Check params
|
|
101
|
-
const data = body;
|
|
102
|
-
const { files } = data;
|
|
103
|
-
if (!files) {
|
|
104
|
-
throw new PublicationError('Missing files in body', 400);
|
|
105
|
-
}
|
|
106
|
-
// Hook for plugins
|
|
107
|
-
config.emit(events_1.ServerEvent.PUBLISH_START, data);
|
|
108
|
-
// Get hosting connector and make sure the user is logged in
|
|
109
|
-
const hostingConnector = await getHostingConnector(session, config, hostingId);
|
|
110
|
-
// Get storage connector which holds the assets
|
|
111
|
-
const storage = await getStorageConnector(session, config, storageId);
|
|
112
|
-
// Load the content if necessary
|
|
113
|
-
const filesList = await Promise.all(files.map(async (file) => {
|
|
114
|
-
const prefix = constants_1.API_WEBSITE_ASSET_READ;
|
|
115
|
-
const fileWithContent = file;
|
|
116
|
-
const fileWithSrc = file;
|
|
117
|
-
if (!fileWithContent.content && !fileWithSrc.src)
|
|
118
|
-
throw new PublicationError('Missing content or src in file', 400);
|
|
119
|
-
const src = fileWithSrc.src?.startsWith(prefix) ? fileWithSrc.src.substring(prefix.length) : fileWithSrc.src;
|
|
120
|
-
return {
|
|
121
|
-
path: file.path,
|
|
122
|
-
content: fileWithContent.content ??
|
|
123
|
-
await storage.readAsset(session, websiteId, src),
|
|
124
|
-
};
|
|
125
|
-
}));
|
|
126
|
-
res.json({
|
|
127
|
-
url: await hostingConnector.getUrl(session, websiteId),
|
|
128
|
-
job: await hostingConnector.publish(session, websiteId, filesList, jobs_1.jobManager),
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
catch (err) {
|
|
132
|
-
console.error('Error publishing the website', err);
|
|
133
|
-
res
|
|
134
|
-
.status(typeof err.code === 'number' ? err.code : 500)
|
|
135
|
-
.json({
|
|
136
|
-
message: `Error publishing the website. ${err.message}`
|
|
137
|
-
});
|
|
138
|
-
// Hook for plugins
|
|
139
|
-
config.emit(events_1.ServerEvent.PUBLISH_END, err);
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
// Hook for plugins
|
|
143
|
-
config.emit(events_1.ServerEvent.PUBLISH_END);
|
|
144
|
-
});
|
|
145
|
-
return router;
|
|
146
|
-
}
|
|
147
|
-
exports.default = default_1;
|
|
148
|
-
//# sourceMappingURL=publicationApi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"publicationApi.js","sourceRoot":"","sources":["../../../../../src/ts/server/api/publicationApi.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,qCAAgC;AAChC,+CAAyG;AACzG,uCAA2S;AAC3S,yDAA0G;AAE1G,oDAAmD;AACnD,sCAAmF;AACnF,kCAA4C;AAE5C;;;GAGG;AAEH;;;;GAIG;AACH,MAAa,gBAAiB,SAAQ,KAAK;IACL;IAApC,YAAY,OAAe,EAAS,IAAY;QAC9C,KAAK,CAAC,OAAO,CAAC,CAAA;QADoB,SAAI,GAAJ,IAAI,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AAI,CAAC;gBACP,GAAG,EAAE,MAAM,gBAAgB,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC;gBACtD,GAAG,EAAE,MAAM,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAU,CAAC;aAC9C,CAAC,CAAA;SACpC;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,GAAG,CAAC,CAAA;YAClD,GAAG;iBACA,MAAM,CAAC,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;iBACrD,IAAI,CAAC;gBACJ,OAAO,EAAE,iCAAiC,GAAG,CAAC,OAAO,EAAE;aACxD,CAAC,CAAA;YACJ,mBAAmB;YACnB,MAAM,CAAC,IAAI,CAAC,oBAAW,CAAC,WAAW,EAAE,GAA0B,CAAC,CAAA;YAChE,OAAM;SACP;QACD,mBAAmB;QACnB,MAAM,CAAC,IAAI,CAAC,oBAAW,CAAC,WAAW,CAAC,CAAA;IACtC,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC;AAlFD,4BAkFC"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Silex website builder, free/libre no-code tool for makers.
|
|
3
|
-
* Copyright (c) 2023 lexoyo and Silex Labs foundation
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU Affero General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or any later version.
|
|
8
|
-
*
|
|
9
|
-
* This program is distributed in the hope that it will be useful,
|
|
10
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
* GNU Affero General Public License for more details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import directusStorage from 'https://unpkg.com/@silexlabs/grapesjs-directus-storage'
|
|
19
|
-
console.log('directusStorage', directusStorage, directusStorage?.default)
|
|
20
|
-
|
|
21
|
-
// Use the environment variable SILEX_CLIENT_CONFIG or the CLI option --client-config to override the default config with this file
|
|
22
|
-
export default async function (config, options) {
|
|
23
|
-
console.log('In example config')
|
|
24
|
-
//await config.addPlugin('gjs-blocks-basic', 'https://unpkg.com/grapesjs-blocks-basic', {
|
|
25
|
-
// blocks: ['text', 'image', 'video', 'map'],
|
|
26
|
-
//})
|
|
27
|
-
|
|
28
|
-
// Optional plugins
|
|
29
|
-
await config.addPlugin([
|
|
30
|
-
'@silexlabs/grapesjs-directus-storage',
|
|
31
|
-
'./plugins/@silexlabs/grapesjs-directus-storage/dist/index.js',
|
|
32
|
-
], {
|
|
33
|
-
'@silexlabs/grapesjs-directus-storage': {
|
|
34
|
-
directusUrl: 'http://localhost:8055',
|
|
35
|
-
},
|
|
36
|
-
'./plugins/@silexlabs/grapesjs-directus-storage/dist/index.js': {
|
|
37
|
-
directusUrl: 'http://localhost:8055',
|
|
38
|
-
},
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
// Return an object to override default config
|
|
42
|
-
return {
|
|
43
|
-
...config,
|
|
44
|
-
...options,
|
|
45
|
-
editor: {
|
|
46
|
-
...config.editor,
|
|
47
|
-
storageManager: {
|
|
48
|
-
autoload: false,
|
|
49
|
-
type: 'directus',
|
|
50
|
-
},
|
|
51
|
-
plugins: [
|
|
52
|
-
...config.editor.plugins,
|
|
53
|
-
directusStorage,
|
|
54
|
-
],
|
|
55
|
-
pluginsOpts: {
|
|
56
|
-
...config.editor.pluginsOpts,
|
|
57
|
-
[directusStorage]: {
|
|
58
|
-
directusUrl: 'http://localhost:8055',
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|