mirror of https://github.com/TriliumNext/Notes
chore(ckeditor5-mermaid): integrate the rest of the files
parent
89f95f6187
commit
07c2f1805e
@ -1,19 +0,0 @@
|
||||
# Configurations to normalize the IDE behavior.
|
||||
# http://editorconfig.org/
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
tab_width = 4
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{js,jsx,ts}]
|
||||
quote_type = single
|
||||
|
||||
[package.json]
|
||||
indent_style = space
|
||||
tab_width = 2
|
||||
@ -1,41 +0,0 @@
|
||||
/* eslint-env node */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
extends: 'ckeditor5',
|
||||
root: true,
|
||||
ignorePatterns: [
|
||||
// Ignore the entire `build/` (the DLL build).
|
||||
'build/**',
|
||||
// Ignore the entire `dist/`.
|
||||
'dist/**'
|
||||
],
|
||||
rules: {
|
||||
// This rule disallows importing core DLL packages directly. Imports should be done using the `ckeditor5` package.
|
||||
// Also, importing non-DLL packages is not allowed. If the package requires other features to work, they should be
|
||||
// specified as soft-requirements.
|
||||
// Read more: https://ckeditor.com/docs/ckeditor5/latest/builds/guides/migration/migration-to-26.html#soft-requirements.
|
||||
'ckeditor5-rules/ckeditor-imports': 'error',
|
||||
// This rule disallows importing from any path other than the package main entrypoint.
|
||||
'ckeditor5-rules/allow-imports-only-from-main-package-entry-point': 'error',
|
||||
// As required by the ECMAScript (ESM) standard, all imports must include a file extension.
|
||||
// If the import does not include it, this rule will try to automatically detect the correct file extension.
|
||||
'ckeditor5-rules/require-file-extensions-in-imports': [
|
||||
'error',
|
||||
{
|
||||
extensions: [ '.ts', '.js', '.json' ]
|
||||
}
|
||||
]
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: [ 'tests/**/*.js', 'sample/**/*.js' ],
|
||||
rules: {
|
||||
// To write complex tests, you may need to import files that are not exported in DLL files by default.
|
||||
// Hence, imports CKEditor 5 packages in test files are not checked.
|
||||
'ckeditor5-rules/ckeditor-imports': 'off'
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
@ -1,18 +0,0 @@
|
||||
* text=auto
|
||||
|
||||
*.htaccess eol=lf
|
||||
*.cgi eol=lf
|
||||
*.sh eol=lf
|
||||
|
||||
*.css text
|
||||
*.htm text
|
||||
*.html text
|
||||
*.js text
|
||||
*.json text
|
||||
*.php text
|
||||
*.txt text
|
||||
*.md text
|
||||
|
||||
*.png -text
|
||||
*.gif -text
|
||||
*.jpg -text
|
||||
@ -1,8 +0,0 @@
|
||||
.nyc_output/
|
||||
coverage/
|
||||
node_modules/
|
||||
yarn.lock
|
||||
tmp/
|
||||
build/
|
||||
dist
|
||||
yarn.error
|
||||
@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "stylelint-config-ckeditor5",
|
||||
"ignoreFiles": [
|
||||
"dist/**/*.css"
|
||||
]
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
Software License Agreement
|
||||
==========================
|
||||
|
||||
**CKEditor 5 mermaid feature** (https://ckeditor.com/ckeditor-5/)<br>
|
||||
Copyright (c) 2003-2022, [CKSource](http://cksource.com) Holding sp. z o.o. All rights reserved.
|
||||
|
||||
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
|
||||
|
||||
Sources of Intellectual Property Included in CKEditor 5 mermaid feature
|
||||
---------------------------------------------------------------------
|
||||
|
||||
Where not otherwise indicated, all CKEditor 5 mermaid feature content is authored by CKSource engineers and consists of CKSource-owned intellectual property.
|
||||
|
||||
The following libraries are included in CKEditor 5 mermaid feature under the [MIT license](https://opensource.org/licenses/MIT):
|
||||
|
||||
* Lo-Dash - Copyright (c) JS Foundation and other contributors https://js.foundation/. Based on Underscore.js, copyright Jeremy Ashkenas.
|
||||
* mermaid - Copyright (c) 2014 - 2021 Knut Sveidqvist. (MIT License)
|
||||
|
||||
Trademarks
|
||||
----------
|
||||
|
||||
**CKEditor** is a trademark of [CKSource](http://cksource.com) Holding sp. z o.o. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
|
||||
@ -1,24 +0,0 @@
|
||||
CKEditor 5 Mermaid feature
|
||||
=================================
|
||||
|
||||
Warning: This is an experimental plugin that comes with no support, use it at your own risk.
|
||||
|
||||
This package contains a Mermaid feature for CKEditor 5.
|
||||
|
||||
## CKEditor 5 Mermaid - Running manual test
|
||||
|
||||
You can test all of the features of the `ckeditor5-mermaid` plugin with the manual test sample.
|
||||
|
||||
After installing dependencies it's enough to execute the following script at the root of your local clone of the project:
|
||||
|
||||
```
|
||||
yarn start
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
See [LICENSE.md](LICENSE.md) file.
|
||||
|
||||
### Trademarks
|
||||
|
||||
**CKEditor** is a trademark of [CKSource](https://cksource.com) Holding sp. z o.o. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
|
||||
@ -1,76 +0,0 @@
|
||||
{
|
||||
"name": "@ckeditor/ckeditor5-mermaid",
|
||||
"version": "0.0.4",
|
||||
"description": "Mermaid widget for CKEditor 5.",
|
||||
"private": true,
|
||||
"keywords": [
|
||||
"ckeditor",
|
||||
"ckeditor5",
|
||||
"ckeditor 5",
|
||||
"ckeditor5-feature",
|
||||
"ckeditor5-plugin",
|
||||
"ckeditor5-mermaid"
|
||||
],
|
||||
"type": "module",
|
||||
"main": "src/index.js",
|
||||
"license": "SEE LICENSE IN LICENSE.md",
|
||||
"author": "CKSource (https://cksource.com/)",
|
||||
"homepage": "https://github.com/ckeditor/ckeditor5-mermaid",
|
||||
"bugs": "https://github.com/ckeditor/ckeditor5-mermaid/issues",
|
||||
"engines": {
|
||||
"node": ">=18.0.0",
|
||||
"npm": ">=5.7.1"
|
||||
},
|
||||
"files": [
|
||||
"lang",
|
||||
"src/**/*.js",
|
||||
"src/**/*.css",
|
||||
"theme",
|
||||
"build",
|
||||
"ckeditor5-metadata.json"
|
||||
],
|
||||
"dependencies": {
|
||||
"ckeditor5": "43.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ckeditor/ckeditor5-dev-build-tools": "^42.0.0",
|
||||
"@ckeditor/ckeditor5-inspector": "^4.0.0",
|
||||
"@ckeditor/ckeditor5-package-tools": "^2.1.0",
|
||||
"ckeditor5": "latest",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-ckeditor5": "^6.0.0",
|
||||
"http-server": "^14.1.1",
|
||||
"husky": "^4.2.5",
|
||||
"lint-staged": "^12.0.0",
|
||||
"stylelint": "^13.13.1",
|
||||
"stylelint-config-ckeditor5": ">=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"ckeditor5": ">=43.0.0 || ^0.0.0-nightly"
|
||||
},
|
||||
"scripts": {
|
||||
"dll:build": "ckeditor5-package-tools dll:build",
|
||||
"dll:serve": "http-server ./ -o sample/dll.html",
|
||||
"lint": "eslint --quiet --ext .ts src/",
|
||||
"lint:fix": "eslint --quiet --fix --ext .ts src/",
|
||||
"stylelint": "stylelint --quiet --allow-empty-input 'theme/**/*.css'",
|
||||
"test": "ckeditor5-package-tools test",
|
||||
"prepare": "yarn run dll:build",
|
||||
"prepublishOnly": "ckeditor5-package-tools export-package-as-javascript",
|
||||
"postpublish": "ckeditor5-package-tools export-package-as-typescript",
|
||||
"start": "ckeditor5-package-tools start"
|
||||
},
|
||||
"lint-staged": {
|
||||
"**/*.js": [
|
||||
"eslint --quiet"
|
||||
],
|
||||
"**/*.css": [
|
||||
"stylelint --quiet --allow-empty-input"
|
||||
]
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,54 +0,0 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
||||
*/
|
||||
|
||||
/* globals console, window, document */
|
||||
|
||||
import { ClassicEditor } from '@ckeditor/ckeditor5-editor-classic';
|
||||
import { Typing } from '@ckeditor/ckeditor5-typing';
|
||||
import { Paragraph } from '@ckeditor/ckeditor5-paragraph';
|
||||
import { Undo } from '@ckeditor/ckeditor5-undo';
|
||||
import { Enter } from '@ckeditor/ckeditor5-enter';
|
||||
import { Clipboard } from '@ckeditor/ckeditor5-clipboard';
|
||||
import { Link } from '@ckeditor/ckeditor5-link';
|
||||
import { Bold, Italic } from '@ckeditor/ckeditor5-basic-styles';
|
||||
import { CodeBlock } from '@ckeditor/ckeditor5-code-block';
|
||||
|
||||
import CKEditorInspector from '@ckeditor/ckeditor5-inspector';
|
||||
|
||||
import Mermaid from '../src/mermaid.js';
|
||||
|
||||
ClassicEditor
|
||||
.create( document.querySelector( '#editor' ), {
|
||||
plugins: [
|
||||
Typing,
|
||||
Paragraph,
|
||||
Undo,
|
||||
Enter,
|
||||
Clipboard,
|
||||
Link,
|
||||
Bold,
|
||||
Italic,
|
||||
CodeBlock,
|
||||
Mermaid
|
||||
],
|
||||
toolbar: [ 'bold', 'italic', 'link', 'undo', 'redo', 'codeBlock', 'mermaid' ],
|
||||
codeBlock: {
|
||||
languages: [
|
||||
{ language: 'plaintext', label: 'Plain text', class: '' },
|
||||
{ language: 'javascript', label: 'JavaScript' },
|
||||
{ language: 'python', label: 'Python' },
|
||||
{ language: 'mermaid', label: 'Mermaid' }
|
||||
]
|
||||
}
|
||||
|
||||
} )
|
||||
.then( editor => {
|
||||
window.editor = editor;
|
||||
CKEditorInspector.attach( editor );
|
||||
window.console.log( 'CKEditor 5 is ready.', editor );
|
||||
} )
|
||||
.catch( err => {
|
||||
console.error( err.stack );
|
||||
} );
|
||||
@ -1,61 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* @license Copyright (c) 2020-2024, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md.
|
||||
*/
|
||||
|
||||
/* eslint-env node */
|
||||
|
||||
import { createRequire } from 'module';
|
||||
import upath from 'upath';
|
||||
import chalk from 'chalk';
|
||||
import { build } from '@ckeditor/ckeditor5-dev-build-tools';
|
||||
|
||||
function dist( path ) {
|
||||
return upath.join( 'dist', path );
|
||||
}
|
||||
|
||||
( async () => {
|
||||
/**
|
||||
* Step 1
|
||||
*/
|
||||
console.log( chalk.cyan( '1/2: Generating NPM build...' ) );
|
||||
|
||||
const require = createRequire( import.meta.url );
|
||||
const pkg = require( upath.resolve( process.cwd(), './package.json' ) );
|
||||
|
||||
await build( {
|
||||
input: 'src/index.js',
|
||||
output: dist( './index.js' ),
|
||||
external: [
|
||||
'ckeditor5',
|
||||
'ckeditor5-premium-features',
|
||||
...Object.keys( {
|
||||
...pkg.dependencies,
|
||||
...pkg.peerDependencies
|
||||
} )
|
||||
],
|
||||
clean: true,
|
||||
sourceMap: true,
|
||||
translations: '**/*.po'
|
||||
} );
|
||||
|
||||
/**
|
||||
* Step 2
|
||||
*/
|
||||
console.log( chalk.cyan( '2/2: Generating browser build...' ) );
|
||||
|
||||
await build( {
|
||||
input: 'src/index.js',
|
||||
output: dist( 'browser/index.js' ),
|
||||
sourceMap: true,
|
||||
minify: true,
|
||||
browser: true,
|
||||
name: '@ckeditor/ckeditor5-mermaid',
|
||||
external: [
|
||||
'ckeditor5',
|
||||
'ckeditor5-premium-features'
|
||||
]
|
||||
} );
|
||||
} )();
|
||||
@ -1,6 +1,22 @@
|
||||
Software License Agreement
|
||||
==========================
|
||||
|
||||
Copyright (c) 2025. All rights reserved.
|
||||
**CKEditor 5 mermaid feature** (https://ckeditor.com/ckeditor-5/)<br>
|
||||
Copyright (c) 2003-2022, [CKSource](http://cksource.com) Holding sp. z o.o. All rights reserved.
|
||||
|
||||
Licensed under the terms of [MIT license](https://opensource.org/licenses/MIT).
|
||||
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
|
||||
|
||||
Sources of Intellectual Property Included in CKEditor 5 mermaid feature
|
||||
---------------------------------------------------------------------
|
||||
|
||||
Where not otherwise indicated, all CKEditor 5 mermaid feature content is authored by CKSource engineers and consists of CKSource-owned intellectual property.
|
||||
|
||||
The following libraries are included in CKEditor 5 mermaid feature under the [MIT license](https://opensource.org/licenses/MIT):
|
||||
|
||||
* Lo-Dash - Copyright (c) JS Foundation and other contributors https://js.foundation/. Based on Underscore.js, copyright Jeremy Ashkenas.
|
||||
* mermaid - Copyright (c) 2014 - 2021 Knut Sveidqvist. (MIT License)
|
||||
|
||||
Trademarks
|
||||
----------
|
||||
|
||||
**CKEditor** is a trademark of [CKSource](http://cksource.com) Holding sp. z o.o. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { Mermaid as MermaidDll, icons } from '../src/index.js';
|
||||
import Mermaid from '../src/mermaid.js';
|
||||
|
||||
import ckeditor from './../theme/icons/ckeditor.svg';
|
||||
|
||||
describe( 'CKEditor5 Mermaid DLL', () => {
|
||||
it( 'exports Mermaid', () => {
|
||||
expect( MermaidDll ).to.equal( Mermaid );
|
||||
} );
|
||||
|
||||
describe( 'icons', () => {
|
||||
it( 'exports the "ckeditor" icon', () => {
|
||||
expect( icons.ckeditor ).to.equal( ckeditor );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
@ -1,56 +0,0 @@
|
||||
import { describe, expect, it, beforeEach, afterEach } from 'vitest';
|
||||
import { ClassicEditor, Essentials, Paragraph, Heading } from 'ckeditor5';
|
||||
import Mermaid from '../src/mermaid.js';
|
||||
|
||||
describe( 'Mermaid', () => {
|
||||
it( 'should be named', () => {
|
||||
expect( Mermaid.pluginName ).to.equal( 'Mermaid' );
|
||||
} );
|
||||
|
||||
describe( 'init()', () => {
|
||||
let domElement: HTMLElement, editor: ClassicEditor;
|
||||
|
||||
beforeEach( async () => {
|
||||
domElement = document.createElement( 'div' );
|
||||
document.body.appendChild( domElement );
|
||||
|
||||
editor = await ClassicEditor.create( domElement, {
|
||||
licenseKey: 'GPL',
|
||||
plugins: [
|
||||
Paragraph,
|
||||
Heading,
|
||||
Essentials,
|
||||
Mermaid
|
||||
],
|
||||
toolbar: [
|
||||
'mermaid'
|
||||
]
|
||||
} );
|
||||
} );
|
||||
|
||||
afterEach( () => {
|
||||
domElement.remove();
|
||||
return editor.destroy();
|
||||
} );
|
||||
|
||||
it( 'should load Mermaid', () => {
|
||||
const myPlugin = editor.plugins.get( 'Mermaid' );
|
||||
|
||||
expect( myPlugin ).to.be.an.instanceof( Mermaid );
|
||||
} );
|
||||
|
||||
it( 'should add an icon to the toolbar', () => {
|
||||
expect( editor.ui.componentFactory.has( 'mermaid' ) ).to.equal( true );
|
||||
} );
|
||||
|
||||
it( 'should add a text into the editor after clicking the icon', () => {
|
||||
const icon = editor.ui.componentFactory.create( 'mermaid' );
|
||||
|
||||
expect( editor.getData() ).to.equal( '' );
|
||||
|
||||
icon.fire( 'execute' );
|
||||
|
||||
expect( editor.getData() ).to.equal( '<p>Hello CKEditor 5!</p>' );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
Loading…
Reference in New Issue