@ckeditor/ckeditor5-bookmark 0.0.0-nightly-20241025.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE.md +5 -4
- package/README.md +3 -25
- package/package.json +3 -32
- package/CHANGELOG.md +0 -4
- package/build/bookmark.js +0 -4
- package/ckeditor5-metadata.json +0 -24
- package/dist/augmentation.d.ts +0 -28
- package/dist/bookmark.d.ts +0 -34
- package/dist/bookmarkconfig.d.ts +0 -52
- package/dist/bookmarkediting.d.ts +0 -55
- package/dist/bookmarkui.d.ts +0 -170
- package/dist/index-content.css +0 -4
- package/dist/index-editor.css +0 -150
- package/dist/index.css +0 -195
- package/dist/index.css.map +0 -1
- package/dist/index.d.ts +0 -18
- package/dist/index.js +0 -1322
- package/dist/index.js.map +0 -1
- package/dist/insertbookmarkcommand.d.ts +0 -42
- package/dist/ui/bookmarkactionsview.d.ts +0 -106
- package/dist/ui/bookmarkformview.d.ts +0 -122
- package/dist/updatebookmarkcommand.d.ts +0 -46
- package/dist/utils.d.ts +0 -15
- package/lang/contexts.json +0 -13
- package/src/augmentation.d.ts +0 -24
- package/src/augmentation.js +0 -5
- package/src/bookmark.d.ts +0 -30
- package/src/bookmark.js +0 -36
- package/src/bookmarkconfig.d.ts +0 -48
- package/src/bookmarkconfig.js +0 -5
- package/src/bookmarkediting.d.ts +0 -51
- package/src/bookmarkediting.js +0 -212
- package/src/bookmarkui.d.ts +0 -166
- package/src/bookmarkui.js +0 -583
- package/src/index.d.ts +0 -14
- package/src/index.js +0 -13
- package/src/insertbookmarkcommand.d.ts +0 -38
- package/src/insertbookmarkcommand.js +0 -113
- package/src/ui/bookmarkactionsview.d.ts +0 -102
- package/src/ui/bookmarkactionsview.js +0 -154
- package/src/ui/bookmarkformview.d.ts +0 -118
- package/src/ui/bookmarkformview.js +0 -203
- package/src/updatebookmarkcommand.d.ts +0 -42
- package/src/updatebookmarkcommand.js +0 -75
- package/src/utils.d.ts +0 -11
- package/src/utils.js +0 -19
- package/theme/bookmark.css +0 -50
- package/theme/bookmarkactions.css +0 -44
- package/theme/bookmarkform.css +0 -42
package/LICENSE.md
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
Software License Agreement
|
2
2
|
==========================
|
3
3
|
|
4
|
-
**CKEditor
|
4
|
+
**CKEditor 5 bookmark feature** – https://github.com/ckeditor/ckeditor5-bookmark <br>
|
5
5
|
Copyright (c) 2003–2024, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
|
6
6
|
|
7
|
-
|
7
|
+
CKEditor 5 bookmark feature is licensed under a commercial license and is protected by copyright law.
|
8
|
+
For more details about available licensing options please contact us at sales@cksource.com.
|
8
9
|
|
9
10
|
Sources of Intellectual Property Included in CKEditor
|
10
11
|
-----------------------------------------------------
|
11
12
|
|
12
|
-
Where not otherwise indicated, all CKEditor content is authored by CKSource engineers and consists of CKSource-owned intellectual property.
|
13
|
+
Where not otherwise indicated, all CKEditor content is authored by CKSource engineers and consists of CKSource-owned intellectual property.
|
13
14
|
|
14
15
|
Trademarks
|
15
16
|
----------
|
16
17
|
|
17
|
-
**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.
|
18
|
+
**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.
|
package/README.md
CHANGED
@@ -1,26 +1,4 @@
|
|
1
|
-
CKEditor
|
2
|
-
|
1
|
+
CKEditor 5 bookmark
|
2
|
+
===================
|
3
3
|
|
4
|
-
|
5
|
-
[![Coverage Status](https://coveralls.io/repos/github/ckeditor/ckeditor5/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5?branch=master)
|
6
|
-
[![Build Status](https://travis-ci.com/ckeditor/ckeditor5.svg?branch=master)](https://app.travis-ci.com/github/ckeditor/ckeditor5)
|
7
|
-
|
8
|
-
This package contains the bookmark feature for CKEditor 5. It allows to add and manage the bookmarks attached to the content of editor for fast access and more efficient content creation.
|
9
|
-
|
10
|
-
## Demo
|
11
|
-
|
12
|
-
Check out the [demo in the bookmark feature](https://ckeditor.com/docs/ckeditor5/latest/features/bookmarks.html#demo) guide.
|
13
|
-
|
14
|
-
## Documentation
|
15
|
-
|
16
|
-
See the [`@ckeditor/ckeditor5-bookmark` package](https://ckeditor.com/docs/ckeditor5/latest/api/bookmark.html) page in [CKEditor 5 documentation](https://ckeditor.com/docs/ckeditor5/latest/) as well as the [bookmark](https://ckeditor.com/docs/ckeditor5/latest/features/bookmarks.html) feature guide.
|
17
|
-
|
18
|
-
## Installation
|
19
|
-
|
20
|
-
```bash
|
21
|
-
npm install ckeditor5
|
22
|
-
```
|
23
|
-
|
24
|
-
## License
|
25
|
-
|
26
|
-
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).
|
4
|
+
This is an initial package for development purposes. It does not contain code yet.
|
package/package.json
CHANGED
@@ -1,43 +1,14 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-bookmark",
|
3
|
-
"version": "0.0.
|
4
|
-
"description": "Bookmark feature for CKEditor 5.",
|
3
|
+
"version": "0.0.1",
|
5
4
|
"keywords": [
|
6
5
|
"ckeditor",
|
7
6
|
"ckeditor5",
|
8
7
|
"ckeditor 5",
|
9
|
-
"ckeditor5-
|
10
|
-
"ckeditor5-plugin",
|
11
|
-
"ckeditor5-dll"
|
8
|
+
"ckeditor5-lib"
|
12
9
|
],
|
13
|
-
"type": "module",
|
14
|
-
"main": "src/index.js",
|
15
|
-
"dependencies": {
|
16
|
-
"ckeditor5": "0.0.0-nightly-20241025.0",
|
17
|
-
"@ckeditor/ckeditor5-core": "0.0.0-nightly-20241025.0",
|
18
|
-
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-20241025.0",
|
19
|
-
"@ckeditor/ckeditor5-widget": "0.0.0-nightly-20241025.0",
|
20
|
-
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20241025.0",
|
21
|
-
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-20241025.0"
|
22
|
-
},
|
23
10
|
"author": "CKSource (http://cksource.com/)",
|
24
11
|
"license": "GPL-2.0-or-later",
|
25
12
|
"homepage": "https://ckeditor.com/ckeditor-5",
|
26
|
-
"bugs": "https://github.com/ckeditor/ckeditor5/issues"
|
27
|
-
"repository": {
|
28
|
-
"type": "git",
|
29
|
-
"url": "https://github.com/ckeditor/ckeditor5.git",
|
30
|
-
"directory": "packages/ckeditor5-bookmark"
|
31
|
-
},
|
32
|
-
"files": [
|
33
|
-
"dist",
|
34
|
-
"lang",
|
35
|
-
"src/**/*.js",
|
36
|
-
"src/**/*.d.ts",
|
37
|
-
"theme",
|
38
|
-
"build",
|
39
|
-
"ckeditor5-metadata.json",
|
40
|
-
"CHANGELOG.md"
|
41
|
-
],
|
42
|
-
"types": "src/index.d.ts"
|
13
|
+
"bugs": "https://github.com/ckeditor/ckeditor5/issues"
|
43
14
|
}
|
package/CHANGELOG.md
DELETED
package/build/bookmark.js
DELETED
@@ -1,4 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md.
|
4
|
-
*/(()=>{var e={501:(e,t,o)=>{"use strict";o.d(t,{A:()=>n});var i=o(935),r=o.n(i)()((function(e){return e[1]}));r.push([e.id,'.ck-vertical-form .ck-button:after{bottom:-1px;content:"";position:absolute;right:-1px;top:-1px;width:0;z-index:1}.ck-vertical-form .ck-button:focus:after{display:none}@media screen and (max-width:600px){.ck.ck-responsive-form .ck-button:after{bottom:-1px;content:"";position:absolute;right:-1px;top:-1px;width:0;z-index:1}.ck.ck-responsive-form .ck-button:focus:after{display:none}}.ck-vertical-form>.ck-button:nth-last-child(2):after{border-right:1px solid var(--ck-color-base-border)}.ck.ck-responsive-form{padding:var(--ck-spacing-large)}.ck.ck-responsive-form:focus{outline:none}.ck.ck-responsive-form{[dir=ltr] &>:not(:first-child),[dir=rtl] &>:not(:last-child){margin-left:var(--ck-spacing-standard)}}@media screen and (max-width:600px){.ck.ck-responsive-form{padding:0;width:calc(var(--ck-input-width)*.8)}.ck.ck-responsive-form .ck-labeled-field-view{margin:var(--ck-spacing-large) var(--ck-spacing-large) 0}.ck.ck-responsive-form .ck-labeled-field-view .ck-input-number,.ck.ck-responsive-form .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-responsive-form .ck-labeled-field-view .ck-labeled-field-view__error{white-space:normal}.ck.ck-responsive-form>.ck-button:nth-last-child(2):after{border-right:1px solid var(--ck-color-base-border)}.ck.ck-responsive-form>.ck-button:last-child,.ck.ck-responsive-form>.ck-button:nth-last-child(2){border-radius:0;margin-top:var(--ck-spacing-large);padding:var(--ck-spacing-standard)}.ck.ck-responsive-form>.ck-button:last-child:not(:focus),.ck.ck-responsive-form>.ck-button:nth-last-child(2):not(:focus){border-top:1px solid var(--ck-color-base-border)}.ck.ck-responsive-form>.ck-button:last-child,.ck.ck-responsive-form>.ck-button:nth-last-child(2){[dir=ltr] &,[dir=rtl] &{margin-left:0}[dir=rtl] &:last-of-type{border-right:1px solid var(--ck-color-base-border)}}}',""]);const n=r},493:(e,t,o)=>{"use strict";o.d(t,{A:()=>n});var i=o(935),r=o.n(i)()((function(e){return e[1]}));r.push([e.id,":root{--ck-bookmark-icon-hover-fill-color:var(--ck-color-widget-hover-border);--ck-bookmark-icon-selected-fill-color:var(--ck-color-focus-border);--ck-bookmark-icon-animation-duration:var(--ck-widget-handler-animation-duration);--ck-bookmark-icon-animation-curve:var(--ck-widget-handler-animation-curve)}.ck-bookmark.ck-widget{outline:none}.ck-bookmark.ck-widget .ck-bookmark__icon .ck-icon__fill{transition:fill var(--ck-bookmark-icon-animation-duration) var(--ck-bookmark-icon-animation-curve)}.ck-bookmark.ck-widget:hover .ck-bookmark__icon .ck-icon__fill{fill:var(--ck-bookmark-icon-hover-fill-color)}.ck-bookmark.ck-widget.ck-widget_selected{.ck-bookmark__icon .ck-icon__fill{fill:var(--ck-bookmark-icon-selected-fill-color)}}.ck-bookmark.ck-widget.ck-widget_selected,.ck-bookmark.ck-widget.ck-widget_selected:hover{outline:none}.ck-bookmark.ck-widget .ck-bookmark__icon{position:relative;top:-.1em}.ck-bookmark.ck-widget .ck-bookmark__icon .ck-icon{height:1.2em;vertical-align:middle;width:auto}.ck .ck-fake-bookmark-selection{background:var(--ck-color-link-fake-selection)}.ck .ck-fake-bookmark-selection_collapsed{border-right:1px solid var(--ck-color-base-text);height:100%;margin-right:-1px;outline:1px solid hsla(0,0%,100%,.5)}",""]);const n=r},324:(e,t,o)=>{"use strict";o.d(t,{A:()=>n});var i=o(935),r=o.n(i)()((function(e){return e[1]}));r.push([e.id,".ck.ck-bookmark-actions{align-items:center;display:flex}.ck.ck-bookmark-actions .ck-bookmark-actions__preview{cursor:default;font-weight:400;max-width:var(--ck-input-width);min-width:3em;overflow:hidden;text-align:center;text-overflow:ellipsis;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}@media screen and (max-width:600px){.ck.ck-bookmark-actions{display:flex;flex-wrap:wrap}.ck.ck-bookmark-actions .ck-bookmark-actions__preview{flex-basis:100%;margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0;min-width:auto}.ck.ck-bookmark-actions.ck-responsive-form .ck-button{flex-basis:50%;margin-top:var(--ck-spacing-standard)}}",""]);const n=r},731:(e,t,o)=>{"use strict";o.d(t,{A:()=>n});var i=o(935),r=o.n(i)()((function(e){return e[1]}));r.push([e.id,".ck.ck-bookmark-view:focus{outline:none}.ck.ck-bookmark-form{align-items:flex-start;display:flex}@media screen and (max-width:600px){.ck.ck-bookmark-form{flex-wrap:wrap}.ck.ck-bookmark-form .ck-button,.ck.ck-bookmark-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-bookmark-form .ck-button{justify-content:center}.ck.ck-bookmark-form.ck-responsive-form>.ck-button:last-child{border-radius:var(--ck-border-radius);margin:var(--ck-spacing-large);padding:0 var(--ck-spacing-standard)}}",""]);const n=r},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var o=e(t);return t[2]?"@media ".concat(t[2]," {").concat(o,"}"):o})).join("")},t.i=function(e,o,i){"string"==typeof e&&(e=[[null,e,""]]);var r={};if(i)for(var n=0;n<this.length;n++){var s=this[n][0];null!=s&&(r[s]=!0)}for(var a=0;a<e.length;a++){var c=[].concat(e[a]);i&&r[c[0]]||(o&&(c[2]?c[2]="".concat(o," and ").concat(c[2]):c[2]=o),t.push(c))}},t}},591:(e,t,o)=>{"use strict";var i,r=function(){return void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i},n=function(){var e={};return function(t){if(void 0===e[t]){var o=document.querySelector(t);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(e){o=null}e[t]=o}return e[t]}}(),s=[];function a(e){for(var t=-1,o=0;o<s.length;o++)if(s[o].identifier===e){t=o;break}return t}function c(e,t){for(var o={},i=[],r=0;r<e.length;r++){var n=e[r],c=t.base?n[0]+t.base:n[0],l=o[c]||0,d="".concat(c," ").concat(l);o[c]=l+1;var k=a(d),m={css:n[1],media:n[2],sourceMap:n[3]};-1!==k?(s[k].references++,s[k].updater(m)):s.push({identifier:d,updater:f(m,t),references:1}),i.push(d)}return i}function l(e){var t=document.createElement("style"),i=e.attributes||{};if(void 0===i.nonce){var r=o.nc;r&&(i.nonce=r)}if(Object.keys(i).forEach((function(e){t.setAttribute(e,i[e])})),"function"==typeof e.insert)e.insert(t);else{var s=n(e.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(t)}return t}var d,k=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function m(e,t,o,i){var r=o?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(e.styleSheet)e.styleSheet.cssText=k(t,r);else{var n=document.createTextNode(r),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(n,s[t]):e.appendChild(n)}}function u(e,t,o){var i=o.css,r=o.media,n=o.sourceMap;if(r?e.setAttribute("media",r):e.removeAttribute("media"),n&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(n))))," */")),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}var h=null,b=0;function f(e,t){var o,i,r;if(t.singleton){var n=b++;o=h||(h=l(t)),i=m.bind(null,o,n,!1),r=m.bind(null,o,n,!0)}else o=l(t),i=u.bind(null,o,t),r=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(o)};return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else r()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=r());var o=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var i=0;i<o.length;i++){var r=a(o[i]);s[r].references--}for(var n=c(e,t),l=0;l<o.length;l++){var d=a(o[l]);0===s[d].references&&(s[d].updater(),s.splice(d,1))}o=n}}}},782:(e,t,o)=>{e.exports=o(237)("./src/core.js")},783:(e,t,o)=>{e.exports=o(237)("./src/engine.js")},311:(e,t,o)=>{e.exports=o(237)("./src/ui.js")},584:(e,t,o)=>{e.exports=o(237)("./src/utils.js")},901:(e,t,o)=>{e.exports=o(237)("./src/widget.js")},237:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function o(i){var r=t[i];if(void 0!==r)return r.exports;var n=t[i]={id:i,exports:{}};return e[i](n,n.exports,o),n.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nc=void 0;var i={};(()=>{"use strict";o.r(i),o.d(i,{Bookmark:()=>A,BookmarkEditing:()=>B,BookmarkUI:()=>C,InsertBookmarkCommand:()=>p,UpdateBookmarkCommand:()=>v});var e=o(782),t=o(901),r=o(311),n=o(783),s=o(584),a=o(591),c=o.n(a),l=o(501),d={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};c()(l.A,d);l.A.locals;var k=o(731),m={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};c()(k.A,m);k.A.locals;class u extends r.View{constructor(e,t){super(e),this.focusTracker=new s.FocusTracker,this.keystrokes=new s.KeystrokeHandler,this._focusables=new r.ViewCollection;const o=e.t;this._validators=t,this.idInputView=this._createIdInput(),this.buttonView=this._createButton(o("Insert"),"ck-button-action ck-button-bold"),this.buttonView.type="submit",this.children=this._createViewChildren(),this._focusCycler=new r.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});this.setTemplate({tag:"form",attributes:{class:["ck","ck-bookmark-view"],tabindex:"-1"},children:this.children})}render(){super.render(),(0,r.submitHandler)({view:this});[this.idInputView,this.buttonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.idInputView.errorText=t,!1}return!0}resetFormStatus(){this.idInputView.errorText=null}_createViewChildren(){const e=this.createCollection(),t=this.t;return e.add(new r.FormHeaderView(this.locale,{label:t("Bookmark")})),e.add(this._createFormContentView()),e}_createFormContentView(){const e=new r.View(this.locale),t=this.createCollection();return t.add(this.idInputView),t.add(this.buttonView),e.setTemplate({tag:"div",attributes:{class:["ck","ck-bookmark-form","ck-responsive-form"]},children:t}),e}_createIdInput(){const e=this.locale.t,t=new r.LabeledFieldView(this.locale,r.createLabeledInputText);return t.label=e("Bookmark name"),t.infoText=e("Enter the bookmark name without spaces."),t}_createButton(e,t){const o=new r.ButtonView(this.locale);return o.set({label:e,withText:!0}),o.extendTemplate({attributes:{class:t}}),o}get id(){const{element:e}=this.idInputView.fieldView;return e?e.value.trim():null}}var h=o(324),b={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};c()(h.A,b);h.A.locals;class f extends r.View{constructor(t){super(t),this.focusTracker=new s.FocusTracker,this.keystrokes=new s.KeystrokeHandler,this._focusables=new r.ViewCollection;const o=t.t;this.bookmarkPreviewView=this._createBookmarkPreviewView(),this.removeButtonView=this._createButton(o("Remove bookmark"),e.icons.remove,"remove",this.bookmarkPreviewView),this.editButtonView=this._createButton(o("Edit bookmark"),e.icons.pencil,"edit",this.bookmarkPreviewView),this.set("id",void 0),this._focusCycler=new r.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-bookmark-actions","ck-responsive-form"],tabindex:"-1"},children:[this.bookmarkPreviewView,this.editButtonView,this.removeButtonView]})}render(){super.render();[this.editButtonView,this.removeButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,o,i){const n=new r.ButtonView(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n.delegate("execute").to(this,o),n.labelView.unbind("id"),n.labelView.bind("id").to(n,"ariaLabelledBy",(e=>e.split(" ")[0])),n.ariaLabelledBy=`${n.ariaLabelledBy} ${i.id}`,n}_createBookmarkPreviewView(){const e=new r.LabelView(this.locale);return e.extendTemplate({attributes:{class:["ck","ck-bookmark-actions__preview"]}}),e.bind("text").to(this,"id"),e}}function w(e){return!(!e||"string"!=typeof e)&&!/\s/.test(e)}class p extends e.Command{refresh(){const e=this.editor.model.document.selection,t=this._getPositionToInsertBookmark(e);this.isEnabled=!!t}execute(e){if(!e)return;const{bookmarkId:t}=e;if(!w(t))return void(0,s.logWarning)("insert-bookmark-command-executed-with-invalid-name");const o=this.editor,i=o.model,r=i.document.selection;i.change((e=>{let n=this._getPositionToInsertBookmark(r);if(!i.schema.checkChild(n,"bookmark")){const e=o.execute("insertParagraph",{position:n});if(!e)return;n=e}const s=e.createElement("bookmark",{...Object.fromEntries(r.getAttributes()),bookmarkId:t});i.insertObject(s,n,null,{setSelection:"on"})}))}_getPositionToInsertBookmark(e){const t=this.editor.model,o=t.schema,i=e.getFirstRange(),r=i.start;if(g(r,o))return r;for(const{previousPosition:e,item:r}of i){if(r.is("element")&&o.checkChild(r,"$text")&&g(r,o))return t.createPositionAt(r,0);if(g(e,o))return e}return null}}function g(e,t){return!!t.checkChild(e,"bookmark")||!!t.checkChild(e,"paragraph")&&t.checkChild("paragraph","bookmark")}class v extends e.Command{refresh(){const e=_(this.editor.model.document.selection);this.isEnabled=!!e,this.value=e?e.getAttribute("bookmarkId"):void 0}execute(e){if(!e)return;const{bookmarkId:t}=e;if(!w(t))return void(0,s.logWarning)("update-bookmark-command-executed-with-invalid-name");const o=this.editor.model,i=_(o.document.selection);i&&o.change((e=>{e.setAttribute("bookmarkId",t,i)}))}}function _(e){const t=e.getSelectedElement();return t&&t.is("element","bookmark")?t:null}var V=o(493),y={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};c()(V.A,y);V.A.locals;const x=e.icons.bookmarkInline;class B extends e.Plugin{constructor(){super(...arguments),this._bookmarkElements=new Map}static get pluginName(){return"BookmarkEditing"}static get isOfficialPlugin(){return!0}init(){const{editor:e}=this;this._defineSchema(),this._defineConverters(),e.commands.add("insertBookmark",new p(e)),e.commands.add("updateBookmark",new v(e)),this.listenTo(e.model.document,"change:data",(()=>{this._trackBookmarkElements()}))}getElementForBookmarkId(e){for(const[t,o]of this._bookmarkElements)if(o==e)return t;return null}_defineSchema(){this.editor.model.schema.register("bookmark",{inheritAllFrom:"$inlineObject",allowAttributes:"bookmarkId",disallowAttributes:["linkHref","htmlA"]})}_defineConverters(){const{editor:e}=this,{conversion:o,t:i}=e;e.data.htmlProcessor.domConverter.registerInlineObjectMatcher((e=>I(e))),e.editing.view.domConverter.registerInlineObjectMatcher((e=>I(e,!1))),o.for("dataDowncast").elementToElement({model:{name:"bookmark",attributes:["bookmarkId"]},view:(e,{writer:t})=>t.createEmptyElement("a",{id:e.getAttribute("bookmarkId")})}),o.for("editingDowncast").elementToElement({model:{name:"bookmark",attributes:["bookmarkId"]},view:(e,{writer:o})=>{const r=e.getAttribute("bookmarkId"),n=o.createContainerElement("a",{id:r,class:"ck-bookmark"},[this._createBookmarkUIElement(o)]);this._bookmarkElements.set(e,r);return(0,t.toWidget)(n,o,{label:()=>`${r} ${i("bookmark widget")}`})}}),o.for("upcast").add((t=>t.on("element:a",function(e){return(t,o,i)=>{const r=o.viewItem,n=I(r,!1);if(!n||!i.consumable.test(r,n))return;const s=function(e){const t=e.config.get("bookmark.enableNonEmptyAnchorConversion");return void 0===t||t}(e);if(!s&&!r.isEmpty)return;const a=i.writer,c=r.getAttribute("id"),l=r.getAttribute("name"),d=c||l,k=a.createElement("bookmark",{bookmarkId:d});if(!i.safeInsert(k,o.modelCursor))return;i.consumable.consume(r,n),c===l&&i.consumable.consume(r,{attributes:["name"]}),i.updateConversionResult(k,o);const{modelCursor:m,modelRange:u}=i.convertChildren(r,o.modelCursor);o.modelCursor=m,o.modelRange=a.createRange(o.modelRange.start,u.end)}}(e))))}_createBookmarkUIElement(e){return e.createUIElement("span",{class:"ck-bookmark__icon"},(function(e){const t=this.toDomElement(e),o=new r.IconView;return o.set({content:x,isColorInherited:!1}),o.render(),t.appendChild(o.element),t}))}_trackBookmarkElements(){this._bookmarkElements.forEach(((e,t)=>{"$graveyard"===t.root.rootName&&this._bookmarkElements.delete(t)}))}}function I(e,t=!0){if(!("a"===e.name))return null;if(t&&!e.isEmpty)return null;const o=e.hasAttribute("id"),i=e.hasAttribute("name"),r=e.hasAttribute("href");return o&&!r?{name:!0,attributes:["id"]}:i&&!r?{name:!0,attributes:["name"]}:null}const E=e.icons.bookmark,T="bookmark-ui";class C extends e.Plugin{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[B,r.ContextualBalloon]}static get pluginName(){return"BookmarkUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.editing.view.addObserver(n.ClickObserver),this._balloon=e.plugins.get(r.ContextualBalloon),this._createToolbarBookmarkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:T,view:{classes:["ck-fake-bookmark-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:T,view:(e,{writer:t})=>{if(!e.markerRange.isCollapsed)return null;const o=t.createUIElement("span");return t.addClass(["ck-fake-bookmark-selection","ck-fake-bookmark-selection_collapsed"],o),o}})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const e=this.editor,t=new f(e.locale),o=e.commands.get("updateBookmark"),i=e.commands.get("delete");return t.bind("id").to(o,"value"),t.editButtonView.bind("isEnabled").to(o),t.removeButtonView.bind("isEnabled").to(i),this.listenTo(t,"edit",(()=>{this._addFormView()})),this.listenTo(t,"remove",(()=>{this._hideUI(),e.execute("delete")})),t.keystrokes.set("Esc",((e,t)=>{this._hideUI(),t()})),t}_createFormView(){const e=this.editor,t=e.locale,o=e.commands.get("insertBookmark"),i=e.commands.get("updateBookmark"),n=[o,i],s=new((0,r.CssTransitionDisablerMixin)(u))(t,function(e){const{t}=e,o=e.plugins.get(B);return[e=>{if(!e.id)return t("Bookmark must not be empty.")},e=>{if(e.id&&/\s/.test(e.id))return t("Bookmark name cannot contain space characters.")},i=>{const r=e.model.document.selection.getSelectedElement(),n=o.getElementForBookmarkId(i.id);if(r!==n)return n?t("Bookmark name already exists."):void 0}]}(e));return s.idInputView.fieldView.bind("value").to(i,"value"),s.idInputView.bind("isEnabled").toMany(n,"isEnabled",((...e)=>e.some((e=>e)))),s.buttonView.bind("isEnabled").toMany(n,"isEnabled",((...e)=>e.some((e=>e)))),this.listenTo(s,"submit",(()=>{if(s.isValid()){const t=s.id;this._getSelectedBookmarkElement()?e.execute("updateBookmark",{bookmarkId:t}):e.execute("insertBookmark",{bookmarkId:t}),this._closeFormView()}})),this.listenTo(s.idInputView,"change:errorText",(()=>{e.ui.update()})),s.keystrokes.set("Esc",((e,t)=>{this._closeFormView(),t()})),s}_createToolbarBookmarkButton(){const e=this.editor;e.ui.componentFactory.add("bookmark",(()=>{const e=this._createButton(r.ButtonView);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:bookmark",(()=>this._createButton(r.MenuBarMenuListItemButtonView)))}_createButton(e){const t=this.editor,o=t.locale,i=new e(o),r=t.commands.get("insertBookmark"),n=t.commands.get("updateBookmark"),s=o.t;return i.set({label:s("Bookmark"),icon:E}),this.listenTo(i,"execute",(()=>this._showUI(!0))),i.bind("isEnabled").toMany([r,n],"isEnabled",((...e)=>e.some((e=>e)))),i.bind("isOn").to(n,"value",(e=>!!e)),i}_enableBalloonActivators(){const e=this.editor.editing.view.document;this.listenTo(e,"click",(()=>{this._getSelectedBookmarkElement()&&this._showUI()}))}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",((e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((e,t)=>{this._isUIVisible&&(this._hideUI(),t())})),(0,r.clickOutsideHandler)({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_updateFormButtonLabel(e){const t=this.editor.locale.t;this.formView.buttonView.label=t(e?"Update":"Insert")}_addActionsView(){this.actionsView||this._createViews(),this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const e=this.editor.commands.get("updateBookmark");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.formView.idInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.idInputView.fieldView.select(),this.formView.enableCssTransitions()}_closeFormView(){void 0!==this.editor.commands.get("updateBookmark").value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.buttonView.focus(),this.formView.idInputView.fieldView.reset(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedBookmarkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let o=this._getSelectedBookmarkElement(),i=n();this._updateFormButtonLabel(!!o);const r=()=>{const e=this._getSelectedBookmarkElement(),t=n();o&&!e||!o&&t!==i?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),this._updateFormButtonLabel(!!o),o=e,i=t};function n(){return t.selection.focus.getAncestors().reverse().find((e=>e.is("element")))}this.listenTo(e.ui,"update",r),this.listenTo(this._balloon,"change:visibleView",r)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model;let o;const i=this._getSelectedBookmarkElement();if(t.markers.has(T)){const t=Array.from(this.editor.editing.mapper.markerNameToElements(T)),i=e.createRange(e.createPositionBefore(t[0]),e.createPositionAfter(t[t.length-1]));o=e.domConverter.viewRangeToDom(i)}else i&&(o=()=>{const t=this.editor.editing.mapper,o=e.domConverter,r=t.toViewElement(i);return o.mapViewToDom(r)});return o&&{target:o}}_getSelectedBookmarkElement(){const e=this.editor.model.document.selection.getSelectedElement();return e&&e.is("element","bookmark")?e:null}_showFakeVisualSelection(){const e=this.editor.model;e.change((t=>{const o=e.document.selection.getFirstRange();if(e.markers.has(T))t.updateMarker(T,{range:o});else if(o.start.isAtEnd){const i=o.start.getLastMatchingPosition((({item:t})=>!e.schema.isContent(t)),{boundaries:o});t.addMarker(T,{usingOperation:!1,affectsData:!1,range:t.createRange(i,o.end)})}else t.addMarker(T,{usingOperation:!1,affectsData:!1,range:o})}))}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(T)&&e.change((e=>{e.removeMarker(T)}))}}class A extends e.Plugin{static get pluginName(){return"Bookmark"}static get requires(){return[B,C,t.Widget]}static get isOfficialPlugin(){return!0}}})(),(window.CKEditor5=window.CKEditor5||{}).bookmark=i})();
|
package/ckeditor5-metadata.json
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"plugins": [
|
3
|
-
{
|
4
|
-
"name": "Bookmark",
|
5
|
-
"className": "Bookmark",
|
6
|
-
"description": "Allows to insert a bookmark into the content to provide fast access to important sections.",
|
7
|
-
"docs": "features/bookmarks.html",
|
8
|
-
"path": "src/bookmark.js",
|
9
|
-
"uiComponents": [
|
10
|
-
{
|
11
|
-
"type": "Button",
|
12
|
-
"name": "bookmark",
|
13
|
-
"iconPath": "@ckeditor/ckeditor5-core/theme/icons/bookmark.svg"
|
14
|
-
}
|
15
|
-
],
|
16
|
-
"htmlOutput": [
|
17
|
-
{
|
18
|
-
"elements": "a",
|
19
|
-
"attributes": "id"
|
20
|
-
}
|
21
|
-
]
|
22
|
-
}
|
23
|
-
]
|
24
|
-
}
|
package/dist/augmentation.d.ts
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2024, 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
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
-
*/
|
9
|
-
import type { Bookmark, BookmarkEditing, BookmarkUI, InsertBookmarkCommand, UpdateBookmarkCommand, BookmarkConfig } from './index.js';
|
10
|
-
declare module '@ckeditor/ckeditor5-core' {
|
11
|
-
interface EditorConfig {
|
12
|
-
/**
|
13
|
-
* The configuration of the {@link module:bookmark/bookmark~Bookmark} feature.
|
14
|
-
*
|
15
|
-
* Read more in {@link module:bookmark/bookmarkconfig~BookmarkConfig}.
|
16
|
-
*/
|
17
|
-
bookmark?: BookmarkConfig;
|
18
|
-
}
|
19
|
-
interface PluginsMap {
|
20
|
-
[Bookmark.pluginName]: Bookmark;
|
21
|
-
[BookmarkEditing.pluginName]: BookmarkEditing;
|
22
|
-
[BookmarkUI.pluginName]: BookmarkUI;
|
23
|
-
}
|
24
|
-
interface CommandsMap {
|
25
|
-
insertBookmark: InsertBookmarkCommand;
|
26
|
-
updateBookmark: UpdateBookmarkCommand;
|
27
|
-
}
|
28
|
-
}
|
package/dist/bookmark.d.ts
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2024, 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
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
-
*/
|
9
|
-
/**
|
10
|
-
* @module bookmark/bookmark
|
11
|
-
*/
|
12
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
13
|
-
import { Widget } from 'ckeditor5/src/widget.js';
|
14
|
-
import BookmarkUI from './bookmarkui.js';
|
15
|
-
import BookmarkEditing from './bookmarkediting.js';
|
16
|
-
/**
|
17
|
-
* The bookmark feature.
|
18
|
-
*
|
19
|
-
* For a detailed overview, check the {@glink features/bookmarks Bookmarks} feature guide.
|
20
|
-
*/
|
21
|
-
export default class Bookmark extends Plugin {
|
22
|
-
/**
|
23
|
-
* @inheritDoc
|
24
|
-
*/
|
25
|
-
static get pluginName(): "Bookmark";
|
26
|
-
/**
|
27
|
-
* @inheritDoc
|
28
|
-
*/
|
29
|
-
static get requires(): readonly [typeof BookmarkEditing, typeof BookmarkUI, typeof Widget];
|
30
|
-
/**
|
31
|
-
* @inheritDoc
|
32
|
-
*/
|
33
|
-
static get isOfficialPlugin(): true;
|
34
|
-
}
|
package/dist/bookmarkconfig.d.ts
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2024, 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
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
-
*/
|
9
|
-
/**
|
10
|
-
* @module bookmark/bookmarkconfig
|
11
|
-
*/
|
12
|
-
/**
|
13
|
-
* The configuration of the bookmark feature.
|
14
|
-
*
|
15
|
-
* The properties defined in this config are set in the `config.bookmark` namespace.
|
16
|
-
*
|
17
|
-
* ```ts
|
18
|
-
* ClassicEditor
|
19
|
-
* .create( editorElement, {
|
20
|
-
* bookmark: {
|
21
|
-
* // Bookmark configuration.
|
22
|
-
* }
|
23
|
-
* } )
|
24
|
-
* .then( ... )
|
25
|
-
* .catch( ... );
|
26
|
-
* ```
|
27
|
-
*
|
28
|
-
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
29
|
-
*/
|
30
|
-
export interface BookmarkConfig {
|
31
|
-
/**
|
32
|
-
* Allows to convert into bookmarks non-empty anchor elements.
|
33
|
-
*
|
34
|
-
* With this option enabled you will have all non-empty anchors converted into bookmakrs.
|
35
|
-
* For example:
|
36
|
-
*
|
37
|
-
*```html
|
38
|
-
* <a id="bookmark">Bookmark</a>
|
39
|
-
*```
|
40
|
-
*
|
41
|
-
* will be converted into:
|
42
|
-
*
|
43
|
-
*```html
|
44
|
-
* <a id="bookmark"></a>Bookmark
|
45
|
-
*```
|
46
|
-
*
|
47
|
-
* **Note:** This is enabled by default.
|
48
|
-
*
|
49
|
-
* @default true
|
50
|
-
*/
|
51
|
-
enableNonEmptyAnchorConversion?: boolean;
|
52
|
-
}
|
@@ -1,55 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2024, 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
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
-
*/
|
9
|
-
/**
|
10
|
-
* @module bookmark/bookmarkediting
|
11
|
-
*/
|
12
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
13
|
-
import type { Element } from 'ckeditor5/src/engine.js';
|
14
|
-
import '../theme/bookmark.css';
|
15
|
-
/**
|
16
|
-
* The bookmark editing plugin.
|
17
|
-
*/
|
18
|
-
export default class BookmarkEditing extends Plugin {
|
19
|
-
/**
|
20
|
-
* A collection of bookmarks elements in the document.
|
21
|
-
*/
|
22
|
-
private _bookmarkElements;
|
23
|
-
/**
|
24
|
-
* @inheritDoc
|
25
|
-
*/
|
26
|
-
static get pluginName(): "BookmarkEditing";
|
27
|
-
/**
|
28
|
-
* @inheritDoc
|
29
|
-
*/
|
30
|
-
static get isOfficialPlugin(): true;
|
31
|
-
/**
|
32
|
-
* @inheritDoc
|
33
|
-
*/
|
34
|
-
init(): void;
|
35
|
-
/**
|
36
|
-
* Returns the model element for the given bookmark ID if it exists.
|
37
|
-
*/
|
38
|
-
getElementForBookmarkId(bookmarkId: string): Element | null;
|
39
|
-
/**
|
40
|
-
* Defines the schema for the bookmark feature.
|
41
|
-
*/
|
42
|
-
private _defineSchema;
|
43
|
-
/**
|
44
|
-
* Defines the converters for the bookmark feature.
|
45
|
-
*/
|
46
|
-
private _defineConverters;
|
47
|
-
/**
|
48
|
-
* Creates a UI element for the `bookmark` representation in editing view.
|
49
|
-
*/
|
50
|
-
private _createBookmarkUIElement;
|
51
|
-
/**
|
52
|
-
* Tracking the added or removed bookmark elements.
|
53
|
-
*/
|
54
|
-
private _trackBookmarkElements;
|
55
|
-
}
|
package/dist/bookmarkui.d.ts
DELETED
@@ -1,170 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2024, 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
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
-
*/
|
9
|
-
/**
|
10
|
-
* @module bookmark/bookmarkui
|
11
|
-
*/
|
12
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
13
|
-
import { ContextualBalloon, type ViewWithCssTransitionDisabler } from 'ckeditor5/src/ui.js';
|
14
|
-
import BookmarkFormView from './ui/bookmarkformview.js';
|
15
|
-
import BookmarkActionsView from './ui/bookmarkactionsview.js';
|
16
|
-
import BookmarkEditing from './bookmarkediting.js';
|
17
|
-
/**
|
18
|
-
* The UI plugin of the bookmark feature.
|
19
|
-
*
|
20
|
-
* It registers the `'bookmark'` UI button in the editor's {@link module:ui/componentfactory~ComponentFactory component factory}
|
21
|
-
* which inserts the `bookmark` element upon selection.
|
22
|
-
*/
|
23
|
-
export default class BookmarkUI extends Plugin {
|
24
|
-
/**
|
25
|
-
* The actions view displayed inside of the balloon.
|
26
|
-
*/
|
27
|
-
actionsView: BookmarkActionsView | null;
|
28
|
-
/**
|
29
|
-
* The form view displayed inside the balloon.
|
30
|
-
*/
|
31
|
-
formView: BookmarkFormView & ViewWithCssTransitionDisabler | null;
|
32
|
-
/**
|
33
|
-
* The contextual balloon plugin instance.
|
34
|
-
*/
|
35
|
-
private _balloon;
|
36
|
-
/**
|
37
|
-
* @inheritDoc
|
38
|
-
*/
|
39
|
-
static get requires(): readonly [typeof BookmarkEditing, typeof ContextualBalloon];
|
40
|
-
/**
|
41
|
-
* @inheritDoc
|
42
|
-
*/
|
43
|
-
static get pluginName(): "BookmarkUI";
|
44
|
-
/**
|
45
|
-
* @inheritDoc
|
46
|
-
*/
|
47
|
-
static get isOfficialPlugin(): true;
|
48
|
-
/**
|
49
|
-
* @inheritDoc
|
50
|
-
*/
|
51
|
-
init(): void;
|
52
|
-
/**
|
53
|
-
* @inheritDoc
|
54
|
-
*/
|
55
|
-
destroy(): void;
|
56
|
-
/**
|
57
|
-
* Creates views.
|
58
|
-
*/
|
59
|
-
private _createViews;
|
60
|
-
/**
|
61
|
-
* Creates the {@link module:bookmark/ui/bookmarkactionsview~BookmarkActionsView} instance.
|
62
|
-
*/
|
63
|
-
private _createActionsView;
|
64
|
-
/**
|
65
|
-
* Creates the {@link module:bookmark/ui/bookmarkformview~BookmarkFormView} instance.
|
66
|
-
*/
|
67
|
-
private _createFormView;
|
68
|
-
/**
|
69
|
-
* Creates a toolbar Bookmark button. Clicking this button will show
|
70
|
-
* a {@link #_balloon} attached to the selection.
|
71
|
-
*/
|
72
|
-
private _createToolbarBookmarkButton;
|
73
|
-
/**
|
74
|
-
* Creates a button for `bookmark` command to use either in toolbar or in menu bar.
|
75
|
-
*/
|
76
|
-
private _createButton;
|
77
|
-
/**
|
78
|
-
* Attaches actions that control whether the balloon panel containing the
|
79
|
-
* {@link #formView} should be displayed.
|
80
|
-
*/
|
81
|
-
private _enableBalloonActivators;
|
82
|
-
/**
|
83
|
-
* Attaches actions that control whether the balloon panel containing the
|
84
|
-
* {@link #formView} is visible or not.
|
85
|
-
*/
|
86
|
-
private _enableUserBalloonInteractions;
|
87
|
-
/**
|
88
|
-
* Updates the button label. If bookmark is selected label is set to 'Update' otherwise
|
89
|
-
* it is 'Insert'.
|
90
|
-
*/
|
91
|
-
private _updateFormButtonLabel;
|
92
|
-
/**
|
93
|
-
* Adds the {@link #actionsView} to the {@link #_balloon}.
|
94
|
-
*
|
95
|
-
* @internal
|
96
|
-
*/
|
97
|
-
_addActionsView(): void;
|
98
|
-
/**
|
99
|
-
* Adds the {@link #formView} to the {@link #_balloon}.
|
100
|
-
*/
|
101
|
-
private _addFormView;
|
102
|
-
/**
|
103
|
-
* Closes the form view. Decides whether the balloon should be hidden completely.
|
104
|
-
*/
|
105
|
-
private _closeFormView;
|
106
|
-
/**
|
107
|
-
* Removes the {@link #formView} from the {@link #_balloon}.
|
108
|
-
*/
|
109
|
-
private _removeFormView;
|
110
|
-
/**
|
111
|
-
* Shows the correct UI type. It is either {@link #formView} or {@link #actionsView}.
|
112
|
-
*/
|
113
|
-
private _showUI;
|
114
|
-
/**
|
115
|
-
* Removes the {@link #formView} from the {@link #_balloon}.
|
116
|
-
*
|
117
|
-
* See {@link #_addFormView}, {@link #_addActionsView}.
|
118
|
-
*/
|
119
|
-
private _hideUI;
|
120
|
-
/**
|
121
|
-
* Makes the UI react to the {@link module:ui/editorui/editorui~EditorUI#event:update} event to
|
122
|
-
* reposition itself when the editor UI should be refreshed.
|
123
|
-
*
|
124
|
-
* See: {@link #_hideUI} to learn when the UI stops reacting to the `update` event.
|
125
|
-
*/
|
126
|
-
private _startUpdatingUI;
|
127
|
-
/**
|
128
|
-
* Returns `true` when {@link #formView} is in the {@link #_balloon}.
|
129
|
-
*/
|
130
|
-
private get _isFormInPanel();
|
131
|
-
/**
|
132
|
-
* Returns `true` when {@link #actionsView} is in the {@link #_balloon}.
|
133
|
-
*/
|
134
|
-
private get _areActionsInPanel();
|
135
|
-
/**
|
136
|
-
* Returns `true` when {@link #actionsView} is in the {@link #_balloon} and it is
|
137
|
-
* currently visible.
|
138
|
-
*/
|
139
|
-
private get _areActionsVisible();
|
140
|
-
/**
|
141
|
-
* Returns `true` when {@link #actionsView} or {@link #formView} is in the {@link #_balloon}.
|
142
|
-
*/
|
143
|
-
private get _isUIInPanel();
|
144
|
-
/**
|
145
|
-
* Returns `true` when {@link #actionsView} or {@link #formView} is in the {@link #_balloon} and it is
|
146
|
-
* currently visible.
|
147
|
-
*/
|
148
|
-
private get _isUIVisible();
|
149
|
-
/**
|
150
|
-
* Returns positioning options for the {@link #_balloon}. They control the way the balloon is attached
|
151
|
-
* to the target element or selection.
|
152
|
-
*/
|
153
|
-
private _getBalloonPositionData;
|
154
|
-
/**
|
155
|
-
* Returns the bookmark {@link module:engine/view/attributeelement~AttributeElement} under
|
156
|
-
* the {@link module:engine/view/document~Document editing view's} selection or `null`
|
157
|
-
* if there is none.
|
158
|
-
*/
|
159
|
-
private _getSelectedBookmarkElement;
|
160
|
-
/**
|
161
|
-
* Displays a fake visual selection when the contextual balloon is displayed.
|
162
|
-
*
|
163
|
-
* This adds a 'bookmark-ui' marker into the document that is rendered as a highlight on selected text fragment.
|
164
|
-
*/
|
165
|
-
private _showFakeVisualSelection;
|
166
|
-
/**
|
167
|
-
* Hides the fake visual selection created in {@link #_showFakeVisualSelection}.
|
168
|
-
*/
|
169
|
-
private _hideFakeVisualSelection;
|
170
|
-
}
|
package/dist/index-content.css
DELETED