mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 21:11:30 +08:00 
			
		
		
		
	chore(ckeditor5-admonition): integrate code structure
This commit is contained in:
		
							parent
							
								
									19168934bf
								
							
						
					
					
						commit
						b0169d58ae
					
				| @ -1,4 +0,0 @@ | |||||||
| Changelog |  | ||||||
| ========= |  | ||||||
| 
 |  | ||||||
| All changes in the package are documented in https://github.com/ckeditor/ckeditor5/blob/master/CHANGELOG.md. |  | ||||||
| @ -1,4 +0,0 @@ | |||||||
| Contributing |  | ||||||
| ======================================== |  | ||||||
| 
 |  | ||||||
| See the [official contributors' guide to CKEditor 5](https://ckeditor.com/docs/ckeditor5/latest/framework/contributing/contributing.html) to learn more. |  | ||||||
| @ -1,17 +0,0 @@ | |||||||
| Software License Agreement |  | ||||||
| ========================== |  | ||||||
| 
 |  | ||||||
| **CKEditor 5 block quote feature** – https://github.com/ckeditor/ckeditor5-block-quote <br> |  | ||||||
| Copyright (c) 2003–2024, [CKSource Holding sp. z o.o.](https://cksource.com) 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 |  | ||||||
| ----------------------------------------------------- |  | ||||||
| 
 |  | ||||||
| Where not otherwise indicated, all CKEditor content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, CKEditor will incorporate work done by developers outside of CKSource with their express permission. |  | ||||||
| 
 |  | ||||||
| Trademarks |  | ||||||
| ---------- |  | ||||||
| 
 |  | ||||||
| **CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks, or service marks of their respective holders. |  | ||||||
| @ -1,26 +0,0 @@ | |||||||
| CKEditor 5 block quote feature |  | ||||||
| ======================================== |  | ||||||
| 
 |  | ||||||
| [](https://www.npmjs.com/package/@ckeditor/ckeditor5-block-quote) |  | ||||||
| [](https://coveralls.io/github/ckeditor/ckeditor5?branch=master) |  | ||||||
| [](https://app.travis-ci.com/github/ckeditor/ckeditor5) |  | ||||||
| 
 |  | ||||||
| This package implements block quote support for CKEditor 5. |  | ||||||
| 
 |  | ||||||
| ## Demo |  | ||||||
| 
 |  | ||||||
| Check out the [demo in the block quote feature guide](https://ckeditor.com/docs/ckeditor5/latest/features/block-quote.html#demo). |  | ||||||
| 
 |  | ||||||
| ## Documentation |  | ||||||
| 
 |  | ||||||
| See the [`@ckeditor/ckeditor5-block-quote` package](https://ckeditor.com/docs/ckeditor5/latest/api/block-quote.html) page in [CKEditor 5 documentation](https://ckeditor.com/docs/ckeditor5/latest/). |  | ||||||
| 
 |  | ||||||
| ## Installation |  | ||||||
| 
 |  | ||||||
| ```bash |  | ||||||
| npm install ckeditor5 |  | ||||||
| ``` |  | ||||||
| 
 |  | ||||||
| ## License |  | ||||||
| 
 |  | ||||||
| Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html). For full details about the license, please check the `LICENSE.md` file or [https://ckeditor.com/legal/ckeditor-oss-license](https://ckeditor.com/legal/ckeditor-oss-license). |  | ||||||
| @ -1,23 +0,0 @@ | |||||||
| { |  | ||||||
| 	"plugins": [ |  | ||||||
| 		{ |  | ||||||
| 			"name": "Admonitions", |  | ||||||
| 			"className": "Admonition", |  | ||||||
| 			"description": "Implements admonitions (warning, info boxes) in a similar fashion to blockquotes", |  | ||||||
| 			"docs": "features/block-quote.html", |  | ||||||
| 			"path": "src/admonition.js", |  | ||||||
| 			"uiComponents": [ |  | ||||||
| 				{ |  | ||||||
| 					"type": "Button", |  | ||||||
| 					"name": "admonition", |  | ||||||
| 					"iconPath": "theme/icons/admonition.svg" |  | ||||||
| 				} |  | ||||||
| 			], |  | ||||||
| 			"htmlOutput": [ |  | ||||||
| 				{ |  | ||||||
| 					"elements": "aside" |  | ||||||
| 				} |  | ||||||
| 			] |  | ||||||
| 		} |  | ||||||
| 	] |  | ||||||
| } |  | ||||||
| @ -1,3 +0,0 @@ | |||||||
| { |  | ||||||
| 	"Admonition": "Toolbar button tooltip for the Admonition feature." |  | ||||||
| } |  | ||||||
| @ -1,62 +0,0 @@ | |||||||
| { |  | ||||||
|   "name": "@ckeditor/ckeditor5-admonition", |  | ||||||
|   "version": "43.2.0", |  | ||||||
|   "description": "Admonition (info box, warning box) feature for CKEditor 5.", |  | ||||||
|   "keywords": [ |  | ||||||
|     "ckeditor", |  | ||||||
|     "ckeditor5", |  | ||||||
|     "ckeditor 5", |  | ||||||
|     "ckeditor5-feature", |  | ||||||
|     "ckeditor5-plugin", |  | ||||||
|     "ckeditor5-dll" |  | ||||||
|   ], |  | ||||||
|   "type": "module", |  | ||||||
|   "main": "src/index.ts", |  | ||||||
|   "dependencies": { |  | ||||||
|     "@ckeditor/ckeditor5-core": "43.2.0", |  | ||||||
|     "@ckeditor/ckeditor5-enter": "43.2.0", |  | ||||||
|     "@ckeditor/ckeditor5-typing": "43.2.0", |  | ||||||
|     "@ckeditor/ckeditor5-ui": "43.2.0", |  | ||||||
|     "@ckeditor/ckeditor5-utils": "43.2.0", |  | ||||||
|     "ckeditor5": "43.2.0" |  | ||||||
|   }, |  | ||||||
|   "devDependencies": { |  | ||||||
|     "@ckeditor/ckeditor5-basic-styles": "43.2.0", |  | ||||||
|     "@ckeditor/ckeditor5-dev-utils": "^43.0.0", |  | ||||||
|     "@ckeditor/ckeditor5-editor-classic": "43.2.0", |  | ||||||
|     "@ckeditor/ckeditor5-engine": "43.2.0", |  | ||||||
|     "@ckeditor/ckeditor5-heading": "43.2.0", |  | ||||||
|     "@ckeditor/ckeditor5-image": "43.2.0", |  | ||||||
|     "@ckeditor/ckeditor5-list": "43.2.0", |  | ||||||
|     "@ckeditor/ckeditor5-paragraph": "43.2.0", |  | ||||||
|     "@ckeditor/ckeditor5-table": "43.2.0", |  | ||||||
|     "@ckeditor/ckeditor5-theme-lark": "43.2.0", |  | ||||||
|     "typescript": "5.0.4", |  | ||||||
|     "webpack": "^5.94.0", |  | ||||||
|     "webpack-cli": "^5.1.4" |  | ||||||
|   }, |  | ||||||
|   "author": "CKSource (http://cksource.com/)", |  | ||||||
|   "license": "GPL-2.0-or-later", |  | ||||||
|   "homepage": "https://ckeditor.com/ckeditor-5", |  | ||||||
|   "bugs": "https://github.com/ckeditor/ckeditor5/issues", |  | ||||||
|   "repository": { |  | ||||||
|     "type": "git", |  | ||||||
|     "url": "https://github.com/ckeditor/ckeditor5.git", |  | ||||||
|     "directory": "packages/ckeditor5-admonition" |  | ||||||
|   }, |  | ||||||
|   "files": [ |  | ||||||
|     "dist", |  | ||||||
|     "lang", |  | ||||||
|     "src/**/*.js", |  | ||||||
|     "src/**/*.d.ts", |  | ||||||
|     "theme", |  | ||||||
|     "build", |  | ||||||
|     "ckeditor5-metadata.json", |  | ||||||
|     "CHANGELOG.md" |  | ||||||
|   ], |  | ||||||
|   "scripts": { |  | ||||||
|     "dll:build": "webpack", |  | ||||||
|     "build": "tsc -p ./tsconfig.json", |  | ||||||
|     "build:dist": "node ../../scripts/build-package.mjs" |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| @ -1,40 +0,0 @@ | |||||||
| /** |  | ||||||
|  * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. |  | ||||||
|  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 |  | ||||||
|  */ |  | ||||||
| 
 |  | ||||||
| /** |  | ||||||
|  * @module admonition/admonition |  | ||||||
|  */ |  | ||||||
| 
 |  | ||||||
| import { Plugin } from 'ckeditor5/src/core.js'; |  | ||||||
| 
 |  | ||||||
| import AdmonitionEditing from './admonitionediting.js'; |  | ||||||
| import AdmonitionUI from './admonitionui.js'; |  | ||||||
| import AdmonitionAutoformat from './admonitionautoformat.js'; |  | ||||||
| 
 |  | ||||||
| /** |  | ||||||
|  * The block quote plugin. |  | ||||||
|  * |  | ||||||
|  * For more information about this feature check the {@glink api/block-quote package page}. |  | ||||||
|  * |  | ||||||
|  * This is a "glue" plugin which loads the {@link module:block-quote/blockquoteediting~BlockQuoteEditing block quote editing feature} |  | ||||||
|  * and {@link module:block-quote/blockquoteui~BlockQuoteUI block quote UI feature}. |  | ||||||
|  * |  | ||||||
|  * @extends module:core/plugin~Plugin |  | ||||||
|  */ |  | ||||||
| export default class Admonition extends Plugin { |  | ||||||
| 	/** |  | ||||||
| 	 * @inheritDoc |  | ||||||
| 	 */ |  | ||||||
| 	public static get requires() { |  | ||||||
| 		return [ AdmonitionEditing, AdmonitionUI, AdmonitionAutoformat ] as const; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/** |  | ||||||
| 	 * @inheritDoc |  | ||||||
| 	 */ |  | ||||||
| 	public static get pluginName() { |  | ||||||
| 		return 'Admonition' as const; |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| @ -1,23 +0,0 @@ | |||||||
| /** |  | ||||||
|  * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. |  | ||||||
|  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 |  | ||||||
|  */ |  | ||||||
| 
 |  | ||||||
| import type { |  | ||||||
| 	Admonition, |  | ||||||
| 	AdmonitionCommand, |  | ||||||
| 	AdmonitionEditing, |  | ||||||
| 	AdmonitionUI |  | ||||||
| } from './index.js'; |  | ||||||
| 
 |  | ||||||
| declare module '@ckeditor/ckeditor5-core' { |  | ||||||
| 	interface PluginsMap { |  | ||||||
| 		[ Admonition.pluginName ]: Admonition; |  | ||||||
| 		[ AdmonitionEditing.pluginName ]: AdmonitionEditing; |  | ||||||
| 		[ AdmonitionUI.pluginName ]: AdmonitionUI; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	interface CommandsMap { |  | ||||||
| 		admonition: AdmonitionCommand; |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| @ -1,16 +0,0 @@ | |||||||
| /** |  | ||||||
|  * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. |  | ||||||
|  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 |  | ||||||
|  */ |  | ||||||
| 
 |  | ||||||
| /** |  | ||||||
|  * @module admonition |  | ||||||
|  */ |  | ||||||
| 
 |  | ||||||
| export { default as Admonition } from './admonition.js'; |  | ||||||
| export { default as AdmonitionEditing } from './admonitionediting.js'; |  | ||||||
| export { default as AdmonitionUI } from './admonitionui.js'; |  | ||||||
| export { default as AdmonitionAutoformat } from './admonitionautoformat.js'; |  | ||||||
| export type { default as AdmonitionCommand } from './admonitioncommand.js'; |  | ||||||
| 
 |  | ||||||
| import './augmentation.js'; |  | ||||||
| @ -1,12 +0,0 @@ | |||||||
| { |  | ||||||
| 	"extends": "../../tsconfig.dist.json", |  | ||||||
| 	"compilerOptions": { |  | ||||||
| 		"rootDir": "src", |  | ||||||
| 		"types": [ |  | ||||||
| 			"../../typings/types" |  | ||||||
| 		] |  | ||||||
| 	}, |  | ||||||
| 	"include": [ |  | ||||||
| 		"src" |  | ||||||
| 	] |  | ||||||
| } |  | ||||||
| @ -1,10 +0,0 @@ | |||||||
| { |  | ||||||
| 	"extends": "../../tsconfig.release.json", |  | ||||||
| 	"include": [ |  | ||||||
| 		"src", |  | ||||||
| 		"../../typings" |  | ||||||
| 	], |  | ||||||
| 	"exclude": [ |  | ||||||
| 		"tests" |  | ||||||
| 	] |  | ||||||
| } |  | ||||||
| @ -1,19 +0,0 @@ | |||||||
| /** |  | ||||||
|  * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. |  | ||||||
|  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 |  | ||||||
|  */ |  | ||||||
| 
 |  | ||||||
| 'use strict'; |  | ||||||
| 
 |  | ||||||
| /* eslint-env node */ |  | ||||||
| 
 |  | ||||||
| const { builds } = require( '@ckeditor/ckeditor5-dev-utils' ); |  | ||||||
| const webpack = require( 'webpack' ); |  | ||||||
| 
 |  | ||||||
| module.exports = builds.getDllPluginWebpackConfig( webpack, { |  | ||||||
| 	themePath: require.resolve( '@ckeditor/ckeditor5-theme-lark' ), |  | ||||||
| 	packagePath: __dirname, |  | ||||||
| 	manifestPath: require.resolve( 'ckeditor5/build/ckeditor5-dll.manifest.json' ), |  | ||||||
| 	isDevelopmentMode: process.argv.includes( '--mode=development' ), |  | ||||||
| 	tsconfigPath: require.resolve( 'ckeditor5/tsconfig.dll.json' ) |  | ||||||
| } ); |  | ||||||
| @ -3,7 +3,7 @@ | |||||||
|     { |     { | ||||||
|       "name": "Admonition", |       "name": "Admonition", | ||||||
|       "className": "Admonition", |       "className": "Admonition", | ||||||
|       "description": "Adds text to the editor.", |       "description": "Implements admonitions (warning, info boxes) in a similar fashion to blockquotes", | ||||||
|       "path": "src/admonition.ts", |       "path": "src/admonition.ts", | ||||||
|       "uiComponents": [ |       "uiComponents": [ | ||||||
|         { |         { | ||||||
| @ -11,7 +11,12 @@ | |||||||
|           "type": "Button", |           "type": "Button", | ||||||
|           "iconPath": "theme/icons/ckeditor.svg" |           "iconPath": "theme/icons/ckeditor.svg" | ||||||
|         } |         } | ||||||
|       ] |       ], | ||||||
|  | 	  "htmlOutput": [ | ||||||
|  | 			{ | ||||||
|  | 				"elements": "aside" | ||||||
|  | 			} | ||||||
|  | 		] | ||||||
|     } |     } | ||||||
|   ] |   ] | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,3 +1,3 @@ | |||||||
| { | { | ||||||
|   "Admonition": "Content for a tooltip is displayed when a user hovers the CKEditor 5 icon." | 	"Admonition": "Toolbar button tooltip for the Admonition feature." | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| { | { | ||||||
|   "name": "@triliumnext/ckeditor5-admonition", |   "name": "@triliumnext/ckeditor5-admonition", | ||||||
|   "version": "0.0.1", |   "version": "1.0.0", | ||||||
|   "description": "A plugin for CKEditor 5.", |   "description": "Admonition (info box, warning box) feature for CKEditor 5.", | ||||||
|   "keywords": [ |   "keywords": [ | ||||||
|     "ckeditor", |     "ckeditor", | ||||||
|     "ckeditor5", |     "ckeditor5", | ||||||
| @ -23,7 +23,6 @@ | |||||||
|     "./browser/*": null, |     "./browser/*": null, | ||||||
|     "./package.json": "./package.json" |     "./package.json": "./package.json" | ||||||
|   }, |   }, | ||||||
|   "license": "MIT", |  | ||||||
|   "engines": { |   "engines": { | ||||||
|     "node": ">=18.0.0", |     "node": ">=18.0.0", | ||||||
|     "npm": ">=5.7.1" |     "npm": ">=5.7.1" | ||||||
| @ -59,6 +58,8 @@ | |||||||
|   "peerDependencies": { |   "peerDependencies": { | ||||||
|     "ckeditor5": "43.2.0" |     "ckeditor5": "43.2.0" | ||||||
|   }, |   }, | ||||||
|  |   "author": "Elian Doran <contact@eliandoran.me>", | ||||||
|  |   "license": "GPL-2.0-or-later", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|     "build:dist": "node ./scripts/build-dist.mjs", |     "build:dist": "node ./scripts/build-dist.mjs", | ||||||
|     "ts:build": "tsc -p ./tsconfig.release.json", |     "ts:build": "tsc -p ./tsconfig.release.json", | ||||||
|  | |||||||
| @ -1,8 +1,16 @@ | |||||||
| import { Plugin, ButtonView } from 'ckeditor5'; | import { Plugin, ButtonView } from 'ckeditor5'; | ||||||
| 
 | 
 | ||||||
| import ckeditor5Icon from '../theme/icons/ckeditor.svg'; | import admonitionIcon from '../theme/icons/admonition.svg'; | ||||||
|  | import AdmonitionEditing from './admonitionediting.js'; | ||||||
|  | import AdmonitionUI from './admonitionui.js'; | ||||||
|  | import AdmonitionAutoformat from './admonitionautoformat.js'; | ||||||
| 
 | 
 | ||||||
| export default class Admonition extends Plugin { | export default class Admonition extends Plugin { | ||||||
|  | 
 | ||||||
|  | 	public static get requires() { | ||||||
|  | 		return [ AdmonitionEditing, AdmonitionUI, AdmonitionAutoformat ] as const; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	public static get pluginName() { | 	public static get pluginName() { | ||||||
| 		return 'Admonition' as const; | 		return 'Admonition' as const; | ||||||
| 	} | 	} | ||||||
| @ -18,7 +26,7 @@ export default class Admonition extends Plugin { | |||||||
| 
 | 
 | ||||||
| 			view.set( { | 			view.set( { | ||||||
| 				label: t( 'Admonition' ), | 				label: t( 'Admonition' ), | ||||||
| 				icon: ckeditor5Icon, | 				icon: admonitionIcon, | ||||||
| 				tooltip: true | 				tooltip: true | ||||||
| 			} ); | 			} ); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,7 +1,5 @@ | |||||||
| import Plugin from "@ckeditor/ckeditor5-core/src/plugin"; | import { Autoformat, blockAutoformatEditing, Plugin } from "ckeditor5"; | ||||||
| import Autoformat from "@ckeditor/ckeditor5-autoformat/src/autoformat"; | import { AdmonitionType, ADMONITION_TYPES } from "./admonitioncommand.js"; | ||||||
| import blockAutoformatEditing from "@ckeditor/ckeditor5-autoformat/src/blockautoformatediting"; |  | ||||||
| import { AdmonitionType, ADMONITION_TYPES } from "./admonitioncommand"; |  | ||||||
| 
 | 
 | ||||||
| function tryParseAdmonitionType(match: RegExpMatchArray) { | function tryParseAdmonitionType(match: RegExpMatchArray) { | ||||||
| 	if (match.length !== 2) { | 	if (match.length !== 2) { | ||||||
| @ -14,6 +12,7 @@ function tryParseAdmonitionType(match: RegExpMatchArray) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export default class AdmonitionAutoformat extends Plugin { | export default class AdmonitionAutoformat extends Plugin { | ||||||
|  | 
 | ||||||
| 	static get requires() { | 	static get requires() { | ||||||
| 		return [ Autoformat ]; | 		return [ Autoformat ]; | ||||||
| 	} | 	} | ||||||
| @ -7,9 +7,8 @@ | |||||||
|  * @module admonition/admonitioncommand |  * @module admonition/admonitioncommand | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| import { Command } from 'ckeditor5/src/core.js'; | import { Command, first } from 'ckeditor5'; | ||||||
| import { first } from 'ckeditor5/src/utils.js'; | import type { DocumentFragment, Element, Position, Range, Schema, Writer } from 'ckeditor5'; | ||||||
| import type { DocumentFragment, Element, Position, Range, Schema, Writer } from 'ckeditor5/src/engine.js'; |  | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * The block quote command plugin. |  * The block quote command plugin. | ||||||
| @ -7,10 +7,7 @@ | |||||||
|  * @module admonition/admonitionediting |  * @module admonition/admonitionediting | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| import { Plugin } from 'ckeditor5/src/core.js'; | import { Delete, Enter, Plugin, ViewDocumentDeleteEvent, ViewDocumentEnterEvent } from 'ckeditor5'; | ||||||
| import { Enter, type ViewDocumentEnterEvent } from 'ckeditor5/src/enter.js'; |  | ||||||
| import { Delete, type ViewDocumentDeleteEvent } from 'ckeditor5/src/typing.js'; |  | ||||||
| 
 |  | ||||||
| import AdmonitionCommand, { AdmonitionType, ADMONITION_TYPES, DEFAULT_ADMONITION_TYPE, ADMONITION_TYPE_ATTRIBUTE } from './admonitioncommand.js'; | import AdmonitionCommand, { AdmonitionType, ADMONITION_TYPES, DEFAULT_ADMONITION_TYPE, ADMONITION_TYPE_ATTRIBUTE } from './admonitioncommand.js'; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @ -136,7 +133,10 @@ export default class AdmonitionEditing extends Plugin { | |||||||
| 
 | 
 | ||||||
| 		const viewDocument = this.editor.editing.view.document; | 		const viewDocument = this.editor.editing.view.document; | ||||||
| 		const selection = editor.model.document.selection; | 		const selection = editor.model.document.selection; | ||||||
| 		const admonitionCommand: AdmonitionCommand = editor.commands.get( 'admonition' )!; | 		const admonitionCommand = editor.commands.get( 'admonition' ); | ||||||
|  | 		if (!admonitionCommand) { | ||||||
|  | 			return; | ||||||
|  | 		} | ||||||
| 
 | 
 | ||||||
| 		// Overwrite default Enter key behavior.
 | 		// Overwrite default Enter key behavior.
 | ||||||
| 		// If Enter key is pressed with selection collapsed in empty block inside a quote, break the quote.
 | 		// If Enter key is pressed with selection collapsed in empty block inside a quote, break the quote.
 | ||||||
| @ -7,13 +7,12 @@ | |||||||
|  * @module admonition/admonitionui |  * @module admonition/admonitionui | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| import { Plugin, } from 'ckeditor5/src/core.js'; | import { Plugin, addListToDropdown, createDropdown, ListDropdownItemDefinition, SplitButtonView, ViewModel } from 'ckeditor5'; | ||||||
| import { addListToDropdown, createDropdown, ListDropdownButtonDefinition, SplitButtonView, ViewModel } from 'ckeditor5/src/ui.js'; |  | ||||||
| 
 | 
 | ||||||
| import '../theme/blockquote.css'; | import '../theme/blockquote.css'; | ||||||
| import admonitionIcon from '../theme/icons/admonition.svg'; | import admonitionIcon from '../theme/icons/admonition.svg'; | ||||||
| import { Collection } from '@ckeditor/ckeditor5-utils'; | import { AdmonitionType } from './admonitioncommand.js'; | ||||||
| import AdmonitionCommand, { AdmonitionType } from './admonitioncommand'; | import { Collection } from 'ckeditor5'; | ||||||
| 
 | 
 | ||||||
| interface AdmonitionDefinition { | interface AdmonitionDefinition { | ||||||
| 	title: string; | 	title: string; | ||||||
| @ -102,11 +101,14 @@ export default class AdmonitionUI extends Plugin { | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	private _getDropdownItems() { | 	private _getDropdownItems() { | ||||||
| 		const itemDefinitions = new Collection<ListDropdownButtonDefinition>(); | 		const itemDefinitions = new Collection<ListDropdownItemDefinition>(); | ||||||
| 		const command = this.editor.commands.get("admonition") as AdmonitionCommand | 		const command = this.editor.commands.get("admonition"); | ||||||
|  | 		if (!command) { | ||||||
|  | 			return itemDefinitions; | ||||||
|  | 		} | ||||||
| 
 | 
 | ||||||
| 		for (const [ type, admonition ] of Object.entries(ADMONITION_TYPES)) { | 		for (const [ type, admonition ] of Object.entries(ADMONITION_TYPES)) { | ||||||
| 			const definition: ListDropdownButtonDefinition = { | 			const definition: ListDropdownItemDefinition = { | ||||||
| 				type: "button", | 				type: "button", | ||||||
| 				model: new ViewModel({ | 				model: new ViewModel({ | ||||||
| 					commandParam: type, | 					commandParam: type, | ||||||
| @ -1,7 +1,17 @@ | |||||||
|  | import AdmonitionCommand from './admonitioncommand.js'; | ||||||
|  | import AdmonitionEditing from './admonitionediting.js'; | ||||||
|  | import AdmonitionUI from './admonitionui.js'; | ||||||
| import type { Admonition } from './index.js'; | import type { Admonition } from './index.js'; | ||||||
| 
 | 
 | ||||||
| declare module 'ckeditor5' { | declare module 'ckeditor5' { | ||||||
| 	interface PluginsMap { | 	interface PluginsMap { | ||||||
| 		[ Admonition.pluginName ]: Admonition; | 		[ Admonition.pluginName ]: Admonition; | ||||||
|  | 		[ AdmonitionEditing.pluginName ]: AdmonitionEditing; | ||||||
|  | 		[ AdmonitionUI.pluginName ]: AdmonitionUI; | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
|  | 	interface CommandsMap { | ||||||
|  | 		admonition: AdmonitionCommand; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,7 +1,12 @@ | |||||||
| import ckeditor from './../theme/icons/ckeditor.svg'; | import ckeditor from './../theme/icons/ckeditor.svg'; | ||||||
| import './augmentation.js'; | import './augmentation.js'; | ||||||
|  | import "../theme/blockquote.css"; | ||||||
| 
 | 
 | ||||||
| export { default as Admonition } from './admonition.js'; | export { default as Admonition } from './admonition.js'; | ||||||
|  | export { default as AdmonitionEditing } from './admonitionediting.js'; | ||||||
|  | export { default as AdmonitionUI } from './admonitionui.js'; | ||||||
|  | export { default as AdmonitionAutoformat } from './admonitionautoformat.js'; | ||||||
|  | export type { default as AdmonitionCommand } from './admonitioncommand.js'; | ||||||
| 
 | 
 | ||||||
| export const icons = { | export const icons = { | ||||||
| 	ckeditor | 	ckeditor | ||||||
|  | |||||||
| Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB | 
| @ -1 +0,0 @@ | |||||||
| <svg width='68' height='64' viewBox='0 0 68 64' xmlns='http://www.w3.org/2000/svg'><g fill='none' fill-rule='evenodd'><path d='M43.71 11.025a11.508 11.508 0 0 0-1.213 5.159c0 6.42 5.244 11.625 11.713 11.625.083 0 .167 0 .25-.002v16.282a5.464 5.464 0 0 1-2.756 4.739L30.986 60.7a5.548 5.548 0 0 1-5.512 0L4.756 48.828A5.464 5.464 0 0 1 2 44.089V20.344c0-1.955 1.05-3.76 2.756-4.738L25.474 3.733a5.548 5.548 0 0 1 5.512 0l12.724 7.292z' fill='#FFF'/><path d='M45.684 8.79a12.604 12.604 0 0 0-1.329 5.65c0 7.032 5.744 12.733 12.829 12.733.091 0 .183-.001.274-.003v17.834a5.987 5.987 0 0 1-3.019 5.19L31.747 63.196a6.076 6.076 0 0 1-6.037 0L3.02 50.193A5.984 5.984 0 0 1 0 45.003V18.997c0-2.14 1.15-4.119 3.019-5.19L25.71.804a6.076 6.076 0 0 1 6.037 0L45.684 8.79zm-29.44 11.89c-.834 0-1.51.671-1.51 1.498v.715c0 .828.676 1.498 1.51 1.498h25.489c.833 0 1.51-.67 1.51-1.498v-.715c0-.827-.677-1.498-1.51-1.498h-25.49.001zm0 9.227c-.834 0-1.51.671-1.51 1.498v.715c0 .828.676 1.498 1.51 1.498h18.479c.833 0 1.509-.67 1.509-1.498v-.715c0-.827-.676-1.498-1.51-1.498H16.244zm0 9.227c-.834 0-1.51.671-1.51 1.498v.715c0 .828.676 1.498 1.51 1.498h25.489c.833 0 1.51-.67 1.51-1.498v-.715c0-.827-.677-1.498-1.51-1.498h-25.49.001zm41.191-14.459c-5.835 0-10.565-4.695-10.565-10.486 0-5.792 4.73-10.487 10.565-10.487C63.27 3.703 68 8.398 68 14.19c0 5.791-4.73 10.486-10.565 10.486v-.001z' fill='#1EBC61' fill-rule='nonzero'/><path d='M60.857 15.995c0-.467-.084-.875-.251-1.225a2.547 2.547 0 0 0-.686-.88 2.888 2.888 0 0 0-1.026-.531 4.418 4.418 0 0 0-1.259-.175c-.134 0-.283.006-.447.018-.15.01-.3.034-.446.07l.075-1.4h3.587v-1.8h-5.462l-.214 5.06c.319-.116.682-.21 1.089-.28.406-.071.77-.107 1.088-.107.218 0 .437.021.655.063.218.041.413.114.585.218s.313.244.422.419c.109.175.163.391.163.65 0 .424-.132.745-.396.961a1.434 1.434 0 0 1-.938.325c-.352 0-.656-.1-.912-.3-.256-.2-.43-.453-.523-.762l-1.925.588c.1.35.258.664.472.943.214.279.47.514.767.706.298.191.63.339.995.443.365.104.749.156 1.151.156.437 0 .86-.064 1.272-.193.41-.13.778-.323 1.1-.581a2.8 2.8 0 0 0 .775-.981c.193-.396.29-.864.29-1.405h-.001z' fill='#FFF' fill-rule='nonzero'/></g></svg> |  | ||||||
| Before Width: | Height: | Size: 2.1 KiB | 
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran