@ckeditor/ckeditor5-widget 35.0.1 → 35.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lang/translations/ur.po +29 -0
- package/package.json +21 -21
- package/src/widgetresize/resizer.js +48 -10
- package/src/widgetresize.js +39 -16
- package/src/widgettoolbarrepository.js +18 -1
@@ -0,0 +1,29 @@
|
|
1
|
+
# Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
2
|
+
#
|
3
|
+
# !!! IMPORTANT !!!
|
4
|
+
#
|
5
|
+
# Before you edit this file, please keep in mind that contributing to the project
|
6
|
+
# translations is possible ONLY via the Transifex online service.
|
7
|
+
#
|
8
|
+
# To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
|
9
|
+
#
|
10
|
+
# To learn more, check out the official contributor's guide:
|
11
|
+
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
12
|
+
#
|
13
|
+
msgid ""
|
14
|
+
msgstr ""
|
15
|
+
"Language-Team: Urdu (https://www.transifex.com/ckeditor/teams/11143/ur/)\n"
|
16
|
+
"Language: ur\n"
|
17
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
18
|
+
|
19
|
+
msgctxt "The label used by assistive technologies describing a toolbar attached to a widget."
|
20
|
+
msgid "Widget toolbar"
|
21
|
+
msgstr "آلہ جات برائے وجٹ"
|
22
|
+
|
23
|
+
msgctxt "The title displayed when a mouse is over a button that inserts a paragraph before a block."
|
24
|
+
msgid "Insert paragraph before block"
|
25
|
+
msgstr "پیراگراف سے پہلے کوڈ خانہ نصب کریں"
|
26
|
+
|
27
|
+
msgctxt "The title displayed when a mouse is over a button that inserts a paragraph after a block."
|
28
|
+
msgid "Insert paragraph after block"
|
29
|
+
msgstr "پیراگراف کے بعد کوڈ خانہ نصب کریں"
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-widget",
|
3
|
-
"version": "35.0
|
3
|
+
"version": "35.2.0",
|
4
4
|
"description": "Widget API for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -11,29 +11,29 @@
|
|
11
11
|
],
|
12
12
|
"main": "src/index.js",
|
13
13
|
"dependencies": {
|
14
|
-
"@ckeditor/ckeditor5-core": "^35.0
|
15
|
-
"@ckeditor/ckeditor5-engine": "^35.0
|
16
|
-
"@ckeditor/ckeditor5-enter": "^35.0
|
17
|
-
"@ckeditor/ckeditor5-ui": "^35.0
|
18
|
-
"@ckeditor/ckeditor5-utils": "^35.0
|
19
|
-
"@ckeditor/ckeditor5-typing": "^35.0
|
14
|
+
"@ckeditor/ckeditor5-core": "^35.2.0",
|
15
|
+
"@ckeditor/ckeditor5-engine": "^35.2.0",
|
16
|
+
"@ckeditor/ckeditor5-enter": "^35.2.0",
|
17
|
+
"@ckeditor/ckeditor5-ui": "^35.2.0",
|
18
|
+
"@ckeditor/ckeditor5-utils": "^35.2.0",
|
19
|
+
"@ckeditor/ckeditor5-typing": "^35.2.0",
|
20
20
|
"lodash-es": "^4.17.15"
|
21
21
|
},
|
22
22
|
"devDependencies": {
|
23
|
-
"@ckeditor/ckeditor5-basic-styles": "^35.0
|
24
|
-
"@ckeditor/ckeditor5-block-quote": "^35.0
|
25
|
-
"@ckeditor/ckeditor5-clipboard": "^35.0
|
26
|
-
"@ckeditor/ckeditor5-editor-balloon": "^35.0
|
27
|
-
"@ckeditor/ckeditor5-editor-classic": "^35.0
|
28
|
-
"@ckeditor/ckeditor5-essentials": "^35.0
|
29
|
-
"@ckeditor/ckeditor5-heading": "^35.0
|
30
|
-
"@ckeditor/ckeditor5-horizontal-line": "^35.0
|
31
|
-
"@ckeditor/ckeditor5-image": "^35.0
|
32
|
-
"@ckeditor/ckeditor5-link": "^35.0
|
33
|
-
"@ckeditor/ckeditor5-media-embed": "^35.0
|
34
|
-
"@ckeditor/ckeditor5-paragraph": "^35.0
|
35
|
-
"@ckeditor/ckeditor5-table": "^35.0
|
36
|
-
"@ckeditor/ckeditor5-undo": "^35.0
|
23
|
+
"@ckeditor/ckeditor5-basic-styles": "^35.2.0",
|
24
|
+
"@ckeditor/ckeditor5-block-quote": "^35.2.0",
|
25
|
+
"@ckeditor/ckeditor5-clipboard": "^35.2.0",
|
26
|
+
"@ckeditor/ckeditor5-editor-balloon": "^35.2.0",
|
27
|
+
"@ckeditor/ckeditor5-editor-classic": "^35.2.0",
|
28
|
+
"@ckeditor/ckeditor5-essentials": "^35.2.0",
|
29
|
+
"@ckeditor/ckeditor5-heading": "^35.2.0",
|
30
|
+
"@ckeditor/ckeditor5-horizontal-line": "^35.2.0",
|
31
|
+
"@ckeditor/ckeditor5-image": "^35.2.0",
|
32
|
+
"@ckeditor/ckeditor5-link": "^35.2.0",
|
33
|
+
"@ckeditor/ckeditor5-media-embed": "^35.2.0",
|
34
|
+
"@ckeditor/ckeditor5-paragraph": "^35.2.0",
|
35
|
+
"@ckeditor/ckeditor5-table": "^35.2.0",
|
36
|
+
"@ckeditor/ckeditor5-undo": "^35.2.0"
|
37
37
|
},
|
38
38
|
"engines": {
|
39
39
|
"node": ">=14.0.0",
|
@@ -68,10 +68,27 @@ export default class Resizer {
|
|
68
68
|
*/
|
69
69
|
|
70
70
|
/**
|
71
|
+
* Flag that indicates whether resizer can be used.
|
72
|
+
*
|
71
73
|
* @observable
|
72
74
|
*/
|
73
75
|
this.set( 'isEnabled', true );
|
74
76
|
|
77
|
+
/**
|
78
|
+
* Flag that indicates that resizer is currently focused.
|
79
|
+
*
|
80
|
+
* @observable
|
81
|
+
*/
|
82
|
+
this.set( 'isSelected', false );
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Flag that indicates whether resizer is rendered (visible on the screen).
|
86
|
+
*
|
87
|
+
* @readonly
|
88
|
+
* @observable
|
89
|
+
*/
|
90
|
+
this.bind( 'isVisible' ).to( this, 'isEnabled', this, 'isSelected', ( isEnabled, isSelected ) => isEnabled && isSelected );
|
91
|
+
|
75
92
|
this.decorate( 'begin' );
|
76
93
|
this.decorate( 'cancel' );
|
77
94
|
this.decorate( 'commit' );
|
@@ -86,15 +103,38 @@ export default class Resizer {
|
|
86
103
|
}
|
87
104
|
}, { priority: 'high' } );
|
88
105
|
|
89
|
-
this.on( 'change:
|
90
|
-
|
91
|
-
|
92
|
-
if ( this.isEnabled ) {
|
106
|
+
this.on( 'change:isVisible', () => {
|
107
|
+
if ( this.isVisible ) {
|
108
|
+
this.show();
|
93
109
|
this.redraw();
|
110
|
+
} else {
|
111
|
+
this.hide();
|
94
112
|
}
|
95
113
|
} );
|
96
114
|
}
|
97
115
|
|
116
|
+
/**
|
117
|
+
* Makes resizer visible in the UI.
|
118
|
+
*/
|
119
|
+
show() {
|
120
|
+
const editingView = this._options.editor.editing.view;
|
121
|
+
|
122
|
+
editingView.change( writer => {
|
123
|
+
writer.removeClass( 'ck-hidden', this._viewResizerWrapper );
|
124
|
+
} );
|
125
|
+
}
|
126
|
+
|
127
|
+
/**
|
128
|
+
* Hides resizer in the UI.
|
129
|
+
*/
|
130
|
+
hide() {
|
131
|
+
const editingView = this._options.editor.editing.view;
|
132
|
+
|
133
|
+
editingView.change( writer => {
|
134
|
+
writer.addClass( 'ck-hidden', this._viewResizerWrapper );
|
135
|
+
} );
|
136
|
+
}
|
137
|
+
|
98
138
|
/**
|
99
139
|
* Attaches the resizer to the DOM.
|
100
140
|
*/
|
@@ -112,12 +152,6 @@ export default class Resizer {
|
|
112
152
|
that._appendHandles( domElement );
|
113
153
|
that._appendSizeUI( domElement );
|
114
154
|
|
115
|
-
that.on( 'change:isEnabled', ( evt, propName, newValue ) => {
|
116
|
-
domElement.style.display = newValue ? '' : 'none';
|
117
|
-
} );
|
118
|
-
|
119
|
-
domElement.style.display = that.isEnabled ? '' : 'none';
|
120
|
-
|
121
155
|
return domElement;
|
122
156
|
} );
|
123
157
|
|
@@ -126,6 +160,10 @@ export default class Resizer {
|
|
126
160
|
writer.addClass( 'ck-widget_with-resizer', widgetElement );
|
127
161
|
|
128
162
|
this._viewResizerWrapper = viewResizerWrapper;
|
163
|
+
|
164
|
+
if ( !this.isVisible ) {
|
165
|
+
this.hide();
|
166
|
+
}
|
129
167
|
} );
|
130
168
|
}
|
131
169
|
|
package/src/widgetresize.js
CHANGED
@@ -42,12 +42,12 @@ export default class WidgetResize extends Plugin {
|
|
42
42
|
const domDocument = global.window.document;
|
43
43
|
|
44
44
|
/**
|
45
|
-
* The currently
|
45
|
+
* The currently selected resizer.
|
46
46
|
*
|
47
47
|
* @observable
|
48
|
-
* @member {module:widget/widgetresize/resizer~Resizer|null} #
|
48
|
+
* @member {module:widget/widgetresize/resizer~Resizer|null} #selectedResizer
|
49
49
|
*/
|
50
|
-
this.set( '
|
50
|
+
this.set( 'selectedResizer', null );
|
51
51
|
|
52
52
|
/**
|
53
53
|
* References an active resizer.
|
@@ -77,20 +77,16 @@ export default class WidgetResize extends Plugin {
|
|
77
77
|
this._observer.listenTo( domDocument, 'mousemove', this._mouseMoveListener.bind( this ) );
|
78
78
|
this._observer.listenTo( domDocument, 'mouseup', this._mouseUpListener.bind( this ) );
|
79
79
|
|
80
|
-
const
|
81
|
-
if ( this.
|
82
|
-
this.
|
80
|
+
const redrawSelectedResizer = () => {
|
81
|
+
if ( this.selectedResizer && this.selectedResizer.isVisible ) {
|
82
|
+
this.selectedResizer.redraw();
|
83
83
|
}
|
84
84
|
};
|
85
85
|
|
86
|
-
this.
|
87
|
-
|
88
|
-
// Redraws occurring upon a change of visible resizer must not be throttled, as it is crucial for the initial
|
89
|
-
// render. Without it the resizer frame would be misaligned with resizing host for a fraction of second.
|
90
|
-
this.on( 'change:visibleResizer', redrawFocusedResizer );
|
86
|
+
this._redrawSelectedResizerThrottled = throttle( redrawSelectedResizer, 200 );
|
91
87
|
|
92
88
|
// Redrawing on any change of the UI of the editor (including content changes).
|
93
|
-
this.editor.ui.on( 'update', this.
|
89
|
+
this.editor.ui.on( 'update', this._redrawSelectedResizerThrottled );
|
94
90
|
|
95
91
|
// Remove view widget-resizer mappings for widgets that have been removed from the document.
|
96
92
|
// https://github.com/ckeditor/ckeditor5/issues/10156
|
@@ -105,14 +101,19 @@ export default class WidgetResize extends Plugin {
|
|
105
101
|
}, { priority: 'lowest' } );
|
106
102
|
|
107
103
|
// Resizers need to be redrawn upon window resize, because new window might shrink resize host.
|
108
|
-
this._observer.listenTo( global.window, 'resize', this.
|
104
|
+
this._observer.listenTo( global.window, 'resize', this._redrawSelectedResizerThrottled );
|
109
105
|
|
110
106
|
const viewSelection = this.editor.editing.view.document.selection;
|
111
107
|
|
112
108
|
viewSelection.on( 'change', () => {
|
113
109
|
const selectedElement = viewSelection.getSelectedElement();
|
114
110
|
|
115
|
-
|
111
|
+
const resizer = this.getResizerByViewElement( selectedElement ) || null;
|
112
|
+
if ( resizer ) {
|
113
|
+
this.select( resizer );
|
114
|
+
} else {
|
115
|
+
this.deselect();
|
116
|
+
}
|
116
117
|
} );
|
117
118
|
}
|
118
119
|
|
@@ -126,7 +127,29 @@ export default class WidgetResize extends Plugin {
|
|
126
127
|
resizer.destroy();
|
127
128
|
}
|
128
129
|
|
129
|
-
this.
|
130
|
+
this._redrawSelectedResizerThrottled.cancel();
|
131
|
+
}
|
132
|
+
|
133
|
+
/**
|
134
|
+
* Marks resizer as selected.
|
135
|
+
*
|
136
|
+
* @param {module:widget/widgetresize/resizer~Resizer} resizer
|
137
|
+
*/
|
138
|
+
select( resizer ) {
|
139
|
+
this.deselect();
|
140
|
+
this.selectedResizer = resizer;
|
141
|
+
this.selectedResizer.isSelected = true;
|
142
|
+
}
|
143
|
+
|
144
|
+
/**
|
145
|
+
* Deselects currently set resizer.
|
146
|
+
*/
|
147
|
+
deselect() {
|
148
|
+
if ( this.selectedResizer ) {
|
149
|
+
this.selectedResizer.isSelected = false;
|
150
|
+
}
|
151
|
+
|
152
|
+
this.selectedResizer = null;
|
130
153
|
}
|
131
154
|
|
132
155
|
/**
|
@@ -164,7 +187,7 @@ export default class WidgetResize extends Plugin {
|
|
164
187
|
|
165
188
|
// If the element the resizer is created for is currently focused, it should become visible.
|
166
189
|
if ( this.getResizerByViewElement( selectedElement ) == resizer ) {
|
167
|
-
this.
|
190
|
+
this.select( resizer );
|
168
191
|
}
|
169
192
|
|
170
193
|
return resizer;
|
@@ -160,11 +160,28 @@ export default class WidgetToolbarRepository extends Plugin {
|
|
160
160
|
|
161
161
|
toolbarView.fillFromConfig( items, editor.ui.componentFactory );
|
162
162
|
|
163
|
-
|
163
|
+
const toolbarDefinition = {
|
164
164
|
view: toolbarView,
|
165
165
|
getRelatedElement,
|
166
166
|
balloonClassName
|
167
|
+
};
|
168
|
+
|
169
|
+
// Register the toolbar so it becomes available for Alt+F10 and Esc navigation.
|
170
|
+
editor.ui.addToolbar( toolbarView, {
|
171
|
+
isContextual: true,
|
172
|
+
beforeFocus: () => {
|
173
|
+
const relatedElement = getRelatedElement( editor.editing.view.document.selection );
|
174
|
+
|
175
|
+
if ( relatedElement ) {
|
176
|
+
this._showToolbar( toolbarDefinition, relatedElement );
|
177
|
+
}
|
178
|
+
},
|
179
|
+
afterBlur: () => {
|
180
|
+
this._hideToolbar( toolbarDefinition );
|
181
|
+
}
|
167
182
|
} );
|
183
|
+
|
184
|
+
this._toolbarDefinitions.set( toolbarId, toolbarDefinition );
|
168
185
|
}
|
169
186
|
|
170
187
|
/**
|