UNPKG

1.8 kBJavaScriptView Raw
1/**
2 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4 */
5/**
6 * @module editor-classic/classiceditoruiview
7 */
8import { BoxedEditorUIView, InlineEditableUIView, StickyPanelView, ToolbarView } from 'ckeditor5/src/ui';
9import '../theme/classiceditor.css';
10/**
11 * Classic editor UI view. Uses an inline editable and a sticky toolbar, all
12 * enclosed in a boxed UI view.
13 */
14export default class ClassicEditorUIView extends BoxedEditorUIView {
15 /**
16 * Creates an instance of the classic editor UI view.
17 *
18 * @param locale The {@link module:core/editor/editor~Editor#locale} instance.
19 * @param editingView The editing view instance this view is related to.
20 * @param options Configuration options for the view instance.
21 * @param options.shouldToolbarGroupWhenFull When set `true` enables automatic items grouping
22 * in the main {@link module:editor-classic/classiceditoruiview~ClassicEditorUIView#toolbar toolbar}.
23 * See {@link module:ui/toolbar/toolbarview~ToolbarOptions#shouldGroupWhenFull} to learn more.
24 */
25 constructor(locale, editingView, options = {}) {
26 super(locale);
27 this.stickyPanel = new StickyPanelView(locale);
28 this.toolbar = new ToolbarView(locale, {
29 shouldGroupWhenFull: options.shouldToolbarGroupWhenFull
30 });
31 this.editable = new InlineEditableUIView(locale, editingView);
32 }
33 /**
34 * @inheritDoc
35 */
36 render() {
37 super.render();
38 // Set toolbar as a child of a stickyPanel and makes toolbar sticky.
39 this.stickyPanel.content.add(this.toolbar);
40 this.top.add(this.stickyPanel);
41 this.main.add(this.editable);
42 }
43}