mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Started to use CKEditor 5 as richt text editor.
This commit is contained in:
parent
156301b8a4
commit
dbdfe5ea95
9 changed files with 1575 additions and 49 deletions
35
assets/controllers/elements/ckeditor_controller.js
Normal file
35
assets/controllers/elements/ckeditor_controller.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
import {Controller} from "@hotwired/stimulus";
|
||||
|
||||
import { default as FullEditor } from "../../ckeditor/markdown_full";
|
||||
import { default as SingleLineEditor} from "../../ckeditor/markdown_single_line";
|
||||
|
||||
/* stimulusFetch: 'lazy' */
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
const mode = this.element.dataset.mode;
|
||||
const output_format = this.element.dataset.outputFormat;
|
||||
|
||||
let EDITOR_TYPE = "Invalid";
|
||||
|
||||
if(output_format == 'markdown') {
|
||||
if(mode == 'full') {
|
||||
EDITOR_TYPE = FullEditor;
|
||||
} else if(mode == 'single_line') {
|
||||
EDITOR_TYPE = SingleLineEditor;
|
||||
}
|
||||
} else {
|
||||
console.error("Unknown output format: " + output-format);
|
||||
return;
|
||||
}
|
||||
|
||||
this.editor = EDITOR_TYPE.create(this.element, {
|
||||
|
||||
})
|
||||
.then(editor => {
|
||||
console.log(editor);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue