Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ckeditor.txt not loaded for typescript project #64

Closed
viandika opened this issue Jan 28, 2023 · 1 comment
Closed

ckeditor.txt not loaded for typescript project #64

viandika opened this issue Jan 28, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@viandika
Copy link

I'm trying the v2.0.0 of the plugin on strapi v4.5.6 with typescript. I have tried putting copying the example from readme to /config/ckeditor.txt but it doesn't get picked up. I checked the debugger on the browser and found that the injected script is 'globalThis.CKEditorConfig = null'.

Based on the source code, if it is typescript project, it tries to read from the /dist folder. But when building the strapi project, it would not copy/compile ckeditor.txt file because it isn't a typescript file.

getCKEditorConfig() {
const appDir = process.cwd();
const isTSProject = fs.existsSync(`${appDir}/dist`);
const jsDir = isTSProject ? `${appDir}/dist` : appDir;
const filename = `${jsDir}/config/ckeditor.txt`;
return fs.existsSync(filename)
? fs.readFileSync(filename)
: 'globalThis.CKEditorConfig = null'
},

If I change the line to const filename = `${appDir}/config/ckeditor.txt`;, it works as intended. Is there additional configs I need to do for the ckeditor.txt file to be copied during build or should we just remove the isTSProject condition?

@nshenderov
Copy link
Owner

Yeah, I missed that, it probably will be better to remove these isTSProject and jsDir variables and remain only appDir than invent a way to copy that config to the dist directory, since usually, the whole app folder is included and even the config folder isn't excluded.

@nshenderov nshenderov added the bug Something isn't working label Jan 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants