8
0
Просмотр исходного кода

Use selection handler for the editing element.

Kamil Piechaczek 6 лет назад
Родитель
Сommit
8e14ab420c

+ 8 - 2
packages/ckeditor5-horizontal-line/src/horizontalruleediting.js

@@ -10,6 +10,8 @@
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 import { toWidget } from '@ckeditor/ckeditor5-widget/src/utils';
 
+import '../theme/horizontalrule.css';
+
 /**
  * @extends module:core/plugin~Plugin
  */
@@ -40,11 +42,15 @@ export default class HorizontalRuleEditing extends Plugin {
 			model: 'horizontalRule',
 			view: ( modelElement, viewWriter ) => {
 				const label = t( 'Horizontal rule' );
-				const viewElement = viewWriter.createEmptyElement( 'hr' );
+				const viewElement = viewWriter.createContainerElement( 'div' );
 
+				viewWriter.addClass( 'ck-horizontal-rule', viewElement );
 				viewWriter.setCustomProperty( 'hr', true, viewElement );
 
-				return toWidget( viewElement, viewWriter, { label } );
+				return toWidget( viewElement, viewWriter, {
+					label,
+					hasSelectionHandler: true
+				} );
 			}
 		} );
 

+ 12 - 0
packages/ckeditor5-horizontal-line/theme/horizontalrule.css

@@ -0,0 +1,12 @@
+/*
+ * Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
+ */
+
+.ck-horizontal-rule {
+	border: 1px solid var(--ck-color-toolbar-border);
+	border-radius: 50%;
+	width: 90%;
+	margin-left: auto;
+	margin-right: auto;
+}