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

Docs issue report from "framework/guides/plugins/creating-simple-plugin-timestamp.html" #17677

Open
j2s opened this issue Dec 19, 2024 · 4 comments
Labels
squad:core Issue to be handled by the Core team. type:docs This issue reports a task related to documentation (e.g. an idea for a guide).

Comments

@j2s
Copy link

j2s commented Dec 19, 2024

Origin URL

https://ckeditor.com/docs/ckeditor5/latest/framework/guides/plugins/creating-simple-plugin-timestamp.html

Project version

36.0.1

Is the information outdated? How?

The example code does not match that provided if cloned.

The filenames are also different eg in docs: app.js - actually: main.js

The generated code adds to dist/index.html:
<script type="module" crossorigin src="/assets/index-Cj9vh0i5.js"></script>

This gives an error as the paths are absolute, so have to manualy dd a . eg: ./assets/index...

Adding the imagined new code:
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
class Timestamp extends Plugin {
init() {
console.log('Timestamp was initialized.');
}
}
Gives a duplicate plugin error - so remove import line. Code runs.

Add ', Timestamp' to plugins array: rebuild etc, get debugger invoked and
TypeError: Illegal constructor. at:
*/class NE extends Plugin{init(){console.log("Timestamp was initialized.")}}_5.create(document.querySelector("#editor"),{plugins:[O5,Qi,V5,fE,Pk,

......

Is there something missing in the guide? What is it?

No response

Is there anything else you would like to add?

pleaserespond quickly!

User agent

Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0

@j2s j2s added squad:core Issue to be handled by the Core team. type:docs This issue reports a task related to documentation (e.g. an idea for a guide). labels Dec 19, 2024
@j2s
Copy link
Author

j2s commented Dec 19, 2024

Copying files from 'final-project' subdirectory and rebuilding works... - but needs to be reflected in tutorial
This version of build software uses vite – see package.json
Testing was done with direct file path to dist/index.html
Another way to develop is to do 'npm run build' then 'npm run preview'
This runs a mini HTTP server with URL eg http://localhost:4173/
As this runs at root the paths in generated index.html dont need the leading '.' but would be good to know how to change that.

@Witoso
Copy link
Member

Witoso commented Dec 20, 2024

Hmm, this is an outdated version of the page that page, I thought we set up redirects for it. @godai78 could you check?

The proper version is: https://ckeditor.com/docs/ckeditor5/latest/framework/tutorials/creating-simple-plugin-timestamp.html

@j2s
Copy link
Author

j2s commented Dec 21, 2024

Thanks - helpful - this worked.

BTW running the npx -y degit ... line I get:

(node:37278) ExperimentalWarning: CommonJS module /home/xxx/.nvm/versions/node/v23.2.0/lib/node_modules/npm/node_modules/debug/src/node.js is loading ES Module /home/xxx/.nvm/versions/node/v23.2.0/lib/node_modules/npm/node_modules/supports-color/index.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)

Doing: node --trace-warnings /home/xxx/.nvm/versions/node/v23.2.0/bin/npx -y degit ckeditor/ckeditor5-tutorials-examples/timestamp-plugin/starter-files timestamp-plugin

I get

Support for loading ES Module in require() is an experimental feature and might change at any time
    at require (node:internal/modules/helpers:136:16)
    at Object.<anonymous> (/home/xxx/.nvm/versions/node/v23.2.0/lib/node_modules/npm/node_modules/debug/src/node.js:32:24)
    at Module._compile (node:internal/modules/cjs/loader:1550:14)
    at Object..js (node:internal/modules/cjs/loader:1702:10)
    at Module.load (node:internal/modules/cjs/loader:1307:32)
    at Function._load (node:internal/modules/cjs/loader:1121:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:219:24)
    at Module.require (node:internal/modules/cjs/loader:1329:12)
    at require (node:internal/modules/helpers:136:16)

I'm not sure if this is a ckeditor issue - looks like node to me?

@j2s
Copy link
Author

j2s commented Dec 21, 2024

The ExperimentalWarning issue is discussed here: npm/cli#7857

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
squad:core Issue to be handled by the Core team. type:docs This issue reports a task related to documentation (e.g. an idea for a guide).
Projects
None yet
Development

No branches or pull requests

2 participants