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

Custom config causing Uncaught SyntaxError: Unexpected token ':' #160

Closed
stillhartkonzept opened this issue Sep 11, 2024 · 2 comments
Closed
Labels
issue: bug Something isn't working

Comments

@stillhartkonzept
Copy link

Describe the bug
Example ckeditor.js does not work for me. I tried copying the example code in the first ckeditor.js in the documentation and I got console error "Uncaught SyntaxError: Unexpected token ':'" and strapi failed to compile. I tried changing the name of the file to ckeditor.txt and strapi ran, but my new config wasn't visible. I required the code in #127 (comment) AND a file called ckeditor.txt for my new config to work.
I'm running strapi 4.25.9 using node 18.

To Reproduce
Steps to reproduce the behavior:

  1. Install a new version of strapi
  2. Install the ckeditor plugin
  3. copy the example text in the documentation at https://github.com/nshenderov/strapi-plugin-ckeditor into ckeditor.js
  4. run develop

Expected behavior
The config that's documented by the example becomes available as "My Custom Preset"
What actually happened: I got "Uncaught SyntaxError: Unexpected token ':'" and strapi failed to run.

please complete the following information:

  • plugins.js (if exist)
    module.exports = () => ({});

  • package.json
    {
    "name": "gta",
    "private": true,
    "version": "0.1.0",
    "description": "A Strapi application",
    "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi",
    "deploy": "strapi deploy"
    },
    "devDependencies": {},
    "dependencies": {
    "@_sh/strapi-plugin-ckeditor": "^2.1.3",
    "@strapi/plugin-cloud": "4.25.9",
    "@strapi/plugin-graphql": "^4.25.9",
    "@strapi/plugin-i18n": "4.25.9",
    "@strapi/plugin-users-permissions": "4.25.9",
    "@strapi/strapi": "4.25.9",
    "better-sqlite3": "8.6.0",
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    "react-router-dom": "5.3.4",
    "strapi-plugin-navigation": "^2.5.3",
    "styled-components": "5.3.3"
    },
    "author": {
    "name": "A Strapi developer"
    },
    "strapi": {
    "uuid": "6e813ed3-8cb0-4483-96c2-b02cffeb0b21"
    },
    "engines": {
    "node": ">=18.0.0 <=20.x.x",
    "npm": ">=6.0.0"
    },
    "license": "MIT"
    }

  • node version
    18.0.0

@MichaelG-Dev
Copy link

Hello, I had the same problem recently. To fix it, I changed the format of the CKEConfig() function.
I pretty much put presets into an object (it being the "configuration" object) and returned it.

const CKEConfig = () => {
    return {
        presets: {
        myCustomPreset: {
            field: {...},
            editorConfig:{
                plugins: [...],
                toolbar: [...],
                heading: {...},
                image: {...},
                table: {...}
            }
        }
    }
}}```

@nshenderov
Copy link
Owner

There is a typo in the example, I forgot to include the parentheses

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

No branches or pull requests

3 participants