@mapomodule/uikit 1.0.0-alpha.6 → 1.0.0-alpha.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/CHANGELOG.md +953 -0
  2. package/components/ConfirmDialog.vue +58 -37
  3. package/components/Detail/Detail.vue +421 -271
  4. package/components/Detail/DetailLangSwitch.vue +9 -2
  5. package/components/DropArea.vue +63 -56
  6. package/components/Form/Form.vue +218 -0
  7. package/components/Form/FormField.vue +216 -0
  8. package/components/Form/FormGroup.vue +146 -0
  9. package/components/Form/FormTabs.vue +188 -0
  10. package/components/Form/defaults.js +98 -0
  11. package/components/Form/fields/ColorField.vue +79 -0
  12. package/components/{fields → Form/fields}/DateField.vue +20 -11
  13. package/components/Form/fields/DateTimeField.vue +271 -0
  14. package/components/Form/fields/EnhancedMediaField.vue +224 -0
  15. package/components/Form/fields/FileField.vue +125 -0
  16. package/components/Form/fields/FksField.vue +115 -0
  17. package/components/Form/fields/MediaField.vue +159 -0
  18. package/components/Form/fields/MediaM2mField.vue +149 -0
  19. package/components/Form/fields/Repeater.vue +618 -0
  20. package/components/{fields → Form/fields}/SeoPreview.vue +10 -10
  21. package/components/Form/fields/TimeField.vue +154 -0
  22. package/components/Form/fields/mapField/leaflet.injector.js +39 -0
  23. package/components/Form/fields/mapField/mapField.vue +350 -0
  24. package/components/Form/fields/wygEditor/defaults.js +25 -0
  25. package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/mapomedia.plugin.js +7 -6
  26. package/components/Form/fields/wygEditor/wygEditor.vue +285 -0
  27. package/components/Form/fields/wygEditorCKE/defaults.js +103 -0
  28. package/components/Form/fields/wygEditorCKE/utils/ckeditor.injector.js +29 -0
  29. package/components/Form/fields/wygEditorCKE/wygEditorCKE.vue +270 -0
  30. package/components/LangSwitcher.vue +44 -0
  31. package/components/List/List.vue +34 -17
  32. package/components/List/ListActions.vue +22 -4
  33. package/components/List/ListFilters.vue +48 -10
  34. package/components/List/ListHead.vue +11 -3
  35. package/components/List/ListQuickEdit.vue +124 -64
  36. package/components/List/ListTable.vue +118 -18
  37. package/components/Login.vue +17 -7
  38. package/components/LogoutButton.vue +43 -28
  39. package/components/MediaManager/MediaBreadcrumbs.vue +45 -0
  40. package/components/MediaManager/MediaEditor.vue +297 -120
  41. package/components/MediaManager/MediaFileChanger.vue +78 -0
  42. package/components/MediaManager/MediaFolders.vue +224 -116
  43. package/components/MediaManager/MediaGallery.vue +224 -145
  44. package/components/MediaManager/MediaManager.vue +125 -159
  45. package/components/MediaManager/MediaManagerDialog.vue +36 -31
  46. package/components/MediaManager/MediaPreview.vue +258 -0
  47. package/components/MediaManager/MediaUploader.vue +91 -90
  48. package/components/MenuManager/MenuManager.vue +332 -0
  49. package/components/MenuManager/MenuNodeEditor.vue +270 -0
  50. package/components/MenuManager/MenuTreeview.vue +237 -0
  51. package/components/MenuManager/MenuTreeviewNode.vue +208 -0
  52. package/components/PagePreview.vue +58 -0
  53. package/components/SnackBar.vue +5 -7
  54. package/components/ThemeToggle.vue +13 -0
  55. package/components/layout/Sidebar/Sidebar.vue +48 -39
  56. package/components/layout/Sidebar/SidebarList.vue +11 -4
  57. package/components/layout/Sidebar/SidebarListItem.vue +113 -13
  58. package/components/layout/Sidebar/SidebarProfile.vue +42 -0
  59. package/components/layout/Sidebar/SidebarTitle.vue +45 -0
  60. package/components/layout/Topbar/Topbar.vue +11 -9
  61. package/components/layout/routebuilder.js +2 -2
  62. package/defaults/i18n.js +37 -0
  63. package/defaults/vuetify.js +34 -0
  64. package/layouts/default.vue +35 -11
  65. package/layouts/empty.vue +10 -0
  66. package/module.js +7 -5
  67. package/package.json +6 -4
  68. package/pages/index.vue +19 -17
  69. package/static/mapo/ckeditor/plugins/image2/dev/assets/image1.jpg +0 -0
  70. package/static/mapo/ckeditor/plugins/image2/dev/assets/image2.jpg +0 -0
  71. package/static/mapo/ckeditor/plugins/image2/dev/contents.css +35 -0
  72. package/static/mapo/ckeditor/plugins/image2/dev/image2.html +338 -0
  73. package/static/mapo/ckeditor/plugins/image2/dialogs/image2.js +557 -0
  74. package/static/mapo/ckeditor/plugins/image2/icons/hidpi/image.png +0 -0
  75. package/static/mapo/ckeditor/plugins/image2/icons/image.png +0 -0
  76. package/static/mapo/ckeditor/plugins/image2/lang/af.js +21 -0
  77. package/static/mapo/ckeditor/plugins/image2/lang/ar.js +21 -0
  78. package/static/mapo/ckeditor/plugins/image2/lang/az.js +21 -0
  79. package/static/mapo/ckeditor/plugins/image2/lang/bg.js +21 -0
  80. package/static/mapo/ckeditor/plugins/image2/lang/bn.js +21 -0
  81. package/static/mapo/ckeditor/plugins/image2/lang/bs.js +21 -0
  82. package/static/mapo/ckeditor/plugins/image2/lang/ca.js +21 -0
  83. package/static/mapo/ckeditor/plugins/image2/lang/cs.js +21 -0
  84. package/static/mapo/ckeditor/plugins/image2/lang/cy.js +21 -0
  85. package/static/mapo/ckeditor/plugins/image2/lang/da.js +21 -0
  86. package/static/mapo/ckeditor/plugins/image2/lang/de-ch.js +21 -0
  87. package/static/mapo/ckeditor/plugins/image2/lang/de.js +21 -0
  88. package/static/mapo/ckeditor/plugins/image2/lang/el.js +21 -0
  89. package/static/mapo/ckeditor/plugins/image2/lang/en-au.js +21 -0
  90. package/static/mapo/ckeditor/plugins/image2/lang/en-ca.js +21 -0
  91. package/static/mapo/ckeditor/plugins/image2/lang/en-gb.js +21 -0
  92. package/static/mapo/ckeditor/plugins/image2/lang/en.js +21 -0
  93. package/static/mapo/ckeditor/plugins/image2/lang/eo.js +21 -0
  94. package/static/mapo/ckeditor/plugins/image2/lang/es-mx.js +21 -0
  95. package/static/mapo/ckeditor/plugins/image2/lang/es.js +21 -0
  96. package/static/mapo/ckeditor/plugins/image2/lang/et.js +21 -0
  97. package/static/mapo/ckeditor/plugins/image2/lang/eu.js +21 -0
  98. package/static/mapo/ckeditor/plugins/image2/lang/fa.js +21 -0
  99. package/static/mapo/ckeditor/plugins/image2/lang/fi.js +21 -0
  100. package/static/mapo/ckeditor/plugins/image2/lang/fo.js +21 -0
  101. package/static/mapo/ckeditor/plugins/image2/lang/fr-ca.js +21 -0
  102. package/static/mapo/ckeditor/plugins/image2/lang/fr.js +21 -0
  103. package/static/mapo/ckeditor/plugins/image2/lang/gl.js +21 -0
  104. package/static/mapo/ckeditor/plugins/image2/lang/gu.js +21 -0
  105. package/static/mapo/ckeditor/plugins/image2/lang/he.js +21 -0
  106. package/static/mapo/ckeditor/plugins/image2/lang/hi.js +21 -0
  107. package/static/mapo/ckeditor/plugins/image2/lang/hr.js +21 -0
  108. package/static/mapo/ckeditor/plugins/image2/lang/hu.js +21 -0
  109. package/static/mapo/ckeditor/plugins/image2/lang/id.js +21 -0
  110. package/static/mapo/ckeditor/plugins/image2/lang/is.js +21 -0
  111. package/static/mapo/ckeditor/plugins/image2/lang/it.js +21 -0
  112. package/static/mapo/ckeditor/plugins/image2/lang/ja.js +21 -0
  113. package/static/mapo/ckeditor/plugins/image2/lang/ka.js +21 -0
  114. package/static/mapo/ckeditor/plugins/image2/lang/km.js +21 -0
  115. package/static/mapo/ckeditor/plugins/image2/lang/ko.js +21 -0
  116. package/static/mapo/ckeditor/plugins/image2/lang/ku.js +21 -0
  117. package/static/mapo/ckeditor/plugins/image2/lang/lt.js +21 -0
  118. package/static/mapo/ckeditor/plugins/image2/lang/lv.js +21 -0
  119. package/static/mapo/ckeditor/plugins/image2/lang/mk.js +21 -0
  120. package/static/mapo/ckeditor/plugins/image2/lang/mn.js +21 -0
  121. package/static/mapo/ckeditor/plugins/image2/lang/ms.js +21 -0
  122. package/static/mapo/ckeditor/plugins/image2/lang/nb.js +21 -0
  123. package/static/mapo/ckeditor/plugins/image2/lang/nl.js +21 -0
  124. package/static/mapo/ckeditor/plugins/image2/lang/no.js +21 -0
  125. package/static/mapo/ckeditor/plugins/image2/lang/oc.js +21 -0
  126. package/static/mapo/ckeditor/plugins/image2/lang/pl.js +21 -0
  127. package/static/mapo/ckeditor/plugins/image2/lang/pt-br.js +21 -0
  128. package/static/mapo/ckeditor/plugins/image2/lang/pt.js +21 -0
  129. package/static/mapo/ckeditor/plugins/image2/lang/ro.js +21 -0
  130. package/static/mapo/ckeditor/plugins/image2/lang/ru.js +21 -0
  131. package/static/mapo/ckeditor/plugins/image2/lang/si.js +21 -0
  132. package/static/mapo/ckeditor/plugins/image2/lang/sk.js +21 -0
  133. package/static/mapo/ckeditor/plugins/image2/lang/sl.js +21 -0
  134. package/static/mapo/ckeditor/plugins/image2/lang/sq.js +21 -0
  135. package/static/mapo/ckeditor/plugins/image2/lang/sr-latn.js +21 -0
  136. package/static/mapo/ckeditor/plugins/image2/lang/sr.js +21 -0
  137. package/static/mapo/ckeditor/plugins/image2/lang/sv.js +21 -0
  138. package/static/mapo/ckeditor/plugins/image2/lang/th.js +21 -0
  139. package/static/mapo/ckeditor/plugins/image2/lang/tr.js +21 -0
  140. package/static/mapo/ckeditor/plugins/image2/lang/tt.js +21 -0
  141. package/static/mapo/ckeditor/plugins/image2/lang/ug.js +21 -0
  142. package/static/mapo/ckeditor/plugins/image2/lang/uk.js +21 -0
  143. package/static/mapo/ckeditor/plugins/image2/lang/vi.js +21 -0
  144. package/static/mapo/ckeditor/plugins/image2/lang/zh-cn.js +21 -0
  145. package/static/mapo/ckeditor/plugins/image2/lang/zh.js +21 -0
  146. package/static/mapo/ckeditor/plugins/image2/plugin.js +1798 -0
  147. package/static/mapo/ckeditor/plugins/image2/samples/assets/image1.jpg +0 -0
  148. package/static/mapo/ckeditor/plugins/image2/samples/assets/image2.jpg +0 -0
  149. package/static/mapo/ckeditor/plugins/image2/samples/image2.html +68 -0
  150. package/static/mapo/ckeditor/skins/moono/dev/icons16.png +0 -0
  151. package/static/mapo/ckeditor/skins/moono/dev/icons16.svg +2374 -0
  152. package/static/mapo/ckeditor/skins/moono/dev/icons32.png +0 -0
  153. package/static/mapo/ckeditor/skins/moono/dev/icons32.svg +2722 -0
  154. package/static/mapo/ckeditor/skins/moono/dev/locations.json +144 -0
  155. package/static/mapo/ckeditor/skins/moono/dialog.css +5 -0
  156. package/static/mapo/ckeditor/skins/moono/dialog_ie.css +5 -0
  157. package/static/mapo/ckeditor/skins/moono/dialog_ie7.css +5 -0
  158. package/static/mapo/ckeditor/skins/moono/dialog_ie8.css +5 -0
  159. package/static/mapo/ckeditor/skins/moono/dialog_iequirks.css +5 -0
  160. package/static/mapo/ckeditor/skins/moono/editor.css +5 -0
  161. package/static/mapo/ckeditor/skins/moono/editor_gecko.css +5 -0
  162. package/static/mapo/ckeditor/skins/moono/editor_ie.css +5 -0
  163. package/static/mapo/ckeditor/skins/moono/editor_ie7.css +5 -0
  164. package/static/mapo/ckeditor/skins/moono/editor_ie8.css +5 -0
  165. package/static/mapo/ckeditor/skins/moono/editor_iequirks.css +5 -0
  166. package/static/mapo/ckeditor/skins/moono/icons.png +0 -0
  167. package/static/mapo/ckeditor/skins/moono/icons_hidpi.png +0 -0
  168. package/static/mapo/ckeditor/skins/moono/images/anchor.png +0 -0
  169. package/static/mapo/ckeditor/skins/moono/images/arrow.png +0 -0
  170. package/static/mapo/ckeditor/skins/moono/images/close.png +0 -0
  171. package/static/mapo/ckeditor/skins/moono/images/hidpi/anchor.png +0 -0
  172. package/static/mapo/ckeditor/skins/moono/images/hidpi/close.png +0 -0
  173. package/static/mapo/ckeditor/skins/moono/images/hidpi/lock-open.png +0 -0
  174. package/static/mapo/ckeditor/skins/moono/images/hidpi/lock.png +0 -0
  175. package/static/mapo/ckeditor/skins/moono/images/hidpi/refresh.png +0 -0
  176. package/static/mapo/ckeditor/skins/moono/images/lock-open.png +0 -0
  177. package/static/mapo/ckeditor/skins/moono/images/lock.png +0 -0
  178. package/static/mapo/ckeditor/skins/moono/images/refresh.png +0 -0
  179. package/static/mapo/ckeditor/skins/moono/images/spinner.gif +0 -0
  180. package/static/mapo/ckeditor/skins/moono/readme.md +49 -0
  181. package/static/mapo/ckeditor/skins/moono/skin.js +10 -0
  182. package/static/mapo/ckeditor/skins/moono-dark/dialog.css +5 -0
  183. package/static/mapo/ckeditor/skins/moono-dark/dialog_ie.css +5 -0
  184. package/static/mapo/ckeditor/skins/moono-dark/dialog_ie7.css +5 -0
  185. package/static/mapo/ckeditor/skins/moono-dark/dialog_ie8.css +5 -0
  186. package/static/mapo/ckeditor/skins/moono-dark/dialog_iequirks.css +5 -0
  187. package/static/mapo/ckeditor/skins/moono-dark/editor.css +5 -0
  188. package/static/mapo/ckeditor/skins/moono-dark/editor_gecko.css +5 -0
  189. package/static/mapo/ckeditor/skins/moono-dark/editor_ie.css +5 -0
  190. package/static/mapo/ckeditor/skins/moono-dark/editor_ie7.css +5 -0
  191. package/static/mapo/ckeditor/skins/moono-dark/editor_ie8.css +5 -0
  192. package/static/mapo/ckeditor/skins/moono-dark/editor_iequirks.css +5 -0
  193. package/static/mapo/ckeditor/skins/moono-dark/icons.png +0 -0
  194. package/static/mapo/ckeditor/skins/moono-dark/icons_hidpi.png +0 -0
  195. package/static/mapo/ckeditor/skins/moono-dark/images/arrow.png +0 -0
  196. package/static/mapo/ckeditor/skins/moono-dark/images/close.png +0 -0
  197. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/close.png +0 -0
  198. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/lock-open.png +0 -0
  199. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/lock.png +0 -0
  200. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/refresh.png +0 -0
  201. package/static/mapo/ckeditor/skins/moono-dark/images/lock-open.png +0 -0
  202. package/static/mapo/ckeditor/skins/moono-dark/images/lock.png +0 -0
  203. package/static/mapo/ckeditor/skins/moono-dark/images/refresh.png +0 -0
  204. package/static/mapo/ckeditor/skins/moono-dark/readme.md +51 -0
  205. package/static/mapo/ckeditor/skins/moono-dark/skin.js +5 -0
  206. package/static/mapo/tinymce-skins/mapo-dark/content.inline.min.css +7 -0
  207. package/static/mapo/tinymce-skins/mapo-dark/content.min.css +7 -0
  208. package/static/mapo/tinymce-skins/mapo-dark/content.mobile.min.css +7 -0
  209. package/static/mapo/tinymce-skins/mapo-dark/skin.min.css +7 -0
  210. package/static/mapo/tinymce-skins/mapo-dark/skin.mobile.min.css +7 -0
  211. package/static/mapo/tinymce-skins/mapo-light/content.inline.min.css +7 -0
  212. package/static/mapo/tinymce-skins/mapo-light/content.min.css +7 -0
  213. package/static/mapo/tinymce-skins/mapo-light/content.mobile.min.css +7 -0
  214. package/static/mapo/tinymce-skins/mapo-light/skin.min.css +7 -0
  215. package/static/mapo/tinymce-skins/mapo-light/skin.mobile.min.css +7 -0
  216. package/translations/en-US.js +177 -0
  217. package/translations/it-IT.js +180 -0
  218. package/LICENSE.md +0 -20
  219. package/components/Detail/DetailField.vue +0 -132
  220. package/components/Detail/defaults.js +0 -55
  221. package/components/fields/M2mField.vue +0 -95
  222. package/components/fields/MediaField.vue +0 -195
  223. package/components/fields/MediaM2mField.vue +0 -238
  224. package/components/fields/TinyMce/TinyMce.vue +0 -180
  225. package/components/fields/TinyMce/defaults.js +0 -55
  226. package/components/layout/Sidebar/SidebarFooter.vue +0 -70
  227. package/defaults.js +0 -29
  228. package/layouts/error.vue +0 -45
  229. /package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/events.js +0 -0
  230. /package/components/{fields/TinyMce/utils/script.injector.js → Form/fields/wygEditor/utils/tinymce.injector.js} +0 -0
  231. /package/static/{favicon.ico → mapo/favicon.ico} +0 -0
@@ -0,0 +1,557 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * CKEditor 4 LTS ("Long Term Support") is available under the terms of the Extended Support Model.
4
+ */
5
+
6
+ /**
7
+ * @fileOverview Image plugin based on Widgets API
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ CKEDITOR.dialog.add( 'image2', function( editor ) {
13
+
14
+ // RegExp: 123, 123px, empty string ""
15
+ var regexGetSizeOrEmpty = /(^\s*(\d+)(px)?\s*$)|^$/i,
16
+
17
+ lockButtonId = CKEDITOR.tools.getNextId(),
18
+ resetButtonId = CKEDITOR.tools.getNextId(),
19
+
20
+ lang = editor.lang.image2,
21
+ commonLang = editor.lang.common,
22
+
23
+ lockResetStyle = 'margin-top:18px;width:40px;height:20px;',
24
+ lockResetHtml = new CKEDITOR.template(
25
+ '<div>' +
26
+ '<a href="javascript:void(0)" tabindex="-1" title="' + lang.lockRatio + '" class="cke_btn_locked" id="{lockButtonId}" role="checkbox">' +
27
+ '<span class="cke_icon"></span>' +
28
+ '<span class="cke_label">' + lang.lockRatio + '</span>' +
29
+ '</a>' +
30
+
31
+ '<a href="javascript:void(0)" tabindex="-1" title="' + lang.resetSize + '" class="cke_btn_reset" id="{resetButtonId}" role="button">' +
32
+ '<span class="cke_label">' + lang.resetSize + '</span>' +
33
+ '</a>' +
34
+ '</div>' ).output( {
35
+ lockButtonId: lockButtonId,
36
+ resetButtonId: resetButtonId
37
+ } ),
38
+
39
+ helpers = CKEDITOR.plugins.image2,
40
+
41
+ // Editor instance configuration.
42
+ config = editor.config,
43
+
44
+ hasFileBrowser = !!( config.filebrowserImageBrowseUrl || config.filebrowserBrowseUrl ),
45
+
46
+ // Content restrictions defined by the widget which
47
+ // impact on dialog structure and presence of fields.
48
+ features = editor.widgets.registered.image.features,
49
+
50
+ // Functions inherited from image2 plugin.
51
+ getNatural = helpers.getNatural,
52
+
53
+ // Global variables referring to the dialog's context.
54
+ doc, widget, image,
55
+
56
+ // Global variable referring to this dialog's image pre-loader.
57
+ preLoader,
58
+
59
+ // Global variables holding the original size of the image.
60
+ domWidth, domHeight,
61
+
62
+ // Global variables related to image pre-loading.
63
+ preLoadedWidth, preLoadedHeight, srcChanged,
64
+
65
+ // Global variables related to size locking.
66
+ lockRatio, userDefinedLock,
67
+
68
+ // Global variables referring to dialog fields and elements.
69
+ lockButton, resetButton, widthField, heightField,
70
+
71
+ natural;
72
+
73
+ // Validates dimension. Allowed values are:
74
+ // "123px", "123", "" (empty string)
75
+ function validateDimension() {
76
+ var match = this.getValue().match( regexGetSizeOrEmpty ),
77
+ isValid = !!( match && parseInt( match[ 1 ], 10 ) !== 0 );
78
+
79
+ if ( !isValid )
80
+ alert( commonLang.invalidLength.replace( '%1', commonLang[ this.id ] ).replace( '%2', 'px' ) ); // jshint ignore:line
81
+
82
+ return isValid;
83
+ }
84
+
85
+ // Creates a function that pre-loads images. The callback function passes
86
+ // [image, width, height] or null if loading failed.
87
+ //
88
+ // @returns {Function}
89
+ function createPreLoader() {
90
+ var image = doc.createElement( 'img' ),
91
+ listeners = [];
92
+
93
+ function addListener( event, callback ) {
94
+ listeners.push( image.once( event, function( evt ) {
95
+ removeListeners();
96
+ callback( evt );
97
+ } ) );
98
+ }
99
+
100
+ function removeListeners() {
101
+ var l;
102
+
103
+ while ( ( l = listeners.pop() ) )
104
+ l.removeListener();
105
+ }
106
+
107
+ // @param {String} src.
108
+ // @param {Function} callback.
109
+ return function( src, callback, scope ) {
110
+ addListener( 'load', function() {
111
+ // Don't use image.$.(width|height) since it's buggy in IE9-10 (https://dev.ckeditor.com/ticket/11159)
112
+ var dimensions = getNatural( image );
113
+
114
+ callback.call( scope, image, dimensions.width, dimensions.height );
115
+ } );
116
+
117
+ addListener( 'error', function() {
118
+ callback( null );
119
+ } );
120
+
121
+ addListener( 'abort', function() {
122
+ callback( null );
123
+ } );
124
+
125
+ // (#3394)
126
+ var queryStringSeparator = src.indexOf( '?' ) !== -1 ? '&' : '?';
127
+ image.setAttribute( 'src',
128
+ ( config.baseHref || '' ) + src + queryStringSeparator + Math.random().toString( 16 ).substring( 2 ) );
129
+ };
130
+ }
131
+
132
+ // This function updates width and height fields once the
133
+ // "src" field is altered. Along with dimensions, also the
134
+ // dimensions lock is adjusted.
135
+ function onChangeSrc() {
136
+ var value = this.getValue(),
137
+ lockRatioValue = editor.config.image2_defaultLockRatio,
138
+ isLockRatioSet = lockRatioValue !== undefined;
139
+
140
+ toggleDimensions( false );
141
+
142
+ // Remember that src is different than default.
143
+ if ( value !== widget.data.src ) {
144
+ // Update dimensions of the image once it's preloaded.
145
+ preLoader( value, function( image, width, height ) {
146
+ // Re-enable width and height fields.
147
+ toggleDimensions( true );
148
+
149
+ // There was problem loading the image. Unlock ratio.
150
+ if ( !image )
151
+ return toggleLockRatio( ( isLockRatioSet ? lockRatioValue : false ) );
152
+
153
+ // Fill width field with the width of the new image.
154
+ widthField.setValue( editor.config.image2_prefillDimensions === false ? 0 : width );
155
+
156
+ // Fill height field with the height of the new image.
157
+ heightField.setValue( editor.config.image2_prefillDimensions === false ? 0 : height );
158
+
159
+ // Cache the new width and update initial cache (#1348).
160
+ preLoadedWidth = domWidth = width;
161
+
162
+ // Cache the new height and update initial cache (#1348).
163
+ preLoadedHeight = domHeight = height;
164
+
165
+ // Check for new lock value if image exist.
166
+ toggleLockRatio( ( isLockRatioSet ? lockRatioValue : helpers.checkHasNaturalRatio( image ) ) );
167
+ } );
168
+
169
+ srcChanged = true;
170
+ }
171
+
172
+ // Value is the same as in widget data but is was
173
+ // modified back in time. Roll back dimensions when restoring
174
+ // default src.
175
+ else if ( srcChanged ) {
176
+ // Re-enable width and height fields.
177
+ toggleDimensions( true );
178
+
179
+ // Restore width field with cached width.
180
+ widthField.setValue( domWidth );
181
+
182
+ // Restore height field with cached height.
183
+ heightField.setValue( domHeight );
184
+
185
+ // Src equals default one back again.
186
+ srcChanged = false;
187
+ }
188
+
189
+ // Value is the same as in widget data and it hadn't
190
+ // been modified.
191
+ else {
192
+ // Re-enable width and height fields.
193
+ toggleDimensions( true );
194
+ }
195
+ }
196
+
197
+ function onChangeDimension() {
198
+ // If ratio is un-locked, then we don't care what's next.
199
+ if ( !lockRatio )
200
+ return;
201
+
202
+ var value = this.getValue();
203
+
204
+ // No reason to auto-scale or unlock if the field is empty.
205
+ if ( !value )
206
+ return;
207
+
208
+ // If the value of the field is invalid (e.g. with %), unlock ratio.
209
+ if ( !value.match( regexGetSizeOrEmpty ) )
210
+ toggleLockRatio( false );
211
+
212
+ // No automatic re-scale when dimension is '0'.
213
+ if ( value === '0' )
214
+ return;
215
+
216
+ var isWidth = this.id == 'width',
217
+ // If dialog opened for the new image, domWidth and domHeight
218
+ // will be empty. Use dimensions from pre-loader in such case instead.
219
+ width = domWidth || preLoadedWidth,
220
+ height = domHeight || preLoadedHeight;
221
+
222
+ // If changing width, then auto-scale height.
223
+ if ( isWidth )
224
+ value = Math.round( height * ( value / width ) );
225
+
226
+ // If changing height, then auto-scale width.
227
+ else
228
+ value = Math.round( width * ( value / height ) );
229
+
230
+ // If the value is a number, apply it to the other field.
231
+ if ( !isNaN( value ) )
232
+ ( isWidth ? heightField : widthField ).setValue( value );
233
+ }
234
+
235
+ // Set-up function for lock and reset buttons:
236
+ // * Adds lock and reset buttons to focusables. Check if button exist first
237
+ // because it may be disabled e.g. due to ACF restrictions.
238
+ // * Register mouseover and mouseout event listeners for UI manipulations.
239
+ // * Register click event listeners for buttons.
240
+ function onLoadLockReset() {
241
+ var dialog = this.getDialog();
242
+
243
+ function setupMouseClasses( el ) {
244
+ el.on( 'mouseover', function() {
245
+ this.addClass( 'cke_btn_over' );
246
+ }, el );
247
+
248
+ el.on( 'mouseout', function() {
249
+ this.removeClass( 'cke_btn_over' );
250
+ }, el );
251
+ }
252
+
253
+ // Create references to lock and reset buttons for this dialog instance.
254
+ lockButton = doc.getById( lockButtonId );
255
+ resetButton = doc.getById( resetButtonId );
256
+
257
+ // Activate (Un)LockRatio button
258
+ if ( lockButton ) {
259
+ // Consider that there's an additional focusable field
260
+ // in the dialog when the "browse" button is visible.
261
+ dialog.addFocusable( lockButton, 4 + hasFileBrowser );
262
+
263
+ lockButton.on( 'click', function( evt ) {
264
+ toggleLockRatio();
265
+ evt.data && evt.data.preventDefault();
266
+ }, this.getDialog() );
267
+
268
+ setupMouseClasses( lockButton );
269
+ }
270
+
271
+ // Activate the reset size button.
272
+ if ( resetButton ) {
273
+ // Consider that there's an additional focusable field
274
+ // in the dialog when the "browse" button is visible.
275
+ dialog.addFocusable( resetButton, 5 + hasFileBrowser );
276
+
277
+ // Fills width and height fields with the original dimensions of the
278
+ // image (stored in widget#data since widget#init).
279
+ resetButton.on( 'click', function( evt ) {
280
+ // If there's a new image loaded, reset button should revert
281
+ // cached dimensions of pre-loaded DOM element.
282
+ if ( srcChanged ) {
283
+ widthField.setValue( preLoadedWidth );
284
+ heightField.setValue( preLoadedHeight );
285
+ }
286
+
287
+ // If the old image remains, reset button should revert
288
+ // dimensions as loaded when the dialog was first shown.
289
+ else {
290
+ widthField.setValue( domWidth );
291
+ heightField.setValue( domHeight );
292
+ }
293
+
294
+ evt.data && evt.data.preventDefault();
295
+ }, this );
296
+
297
+ setupMouseClasses( resetButton );
298
+ }
299
+ }
300
+
301
+ function toggleLockRatio( enable ) {
302
+ // No locking if there's no radio (i.e. due to ACF).
303
+ if ( !lockButton )
304
+ return;
305
+
306
+ if ( typeof enable == 'boolean' ) {
307
+ // If user explicitly wants to decide whether
308
+ // to lock or not, don't do anything.
309
+ if ( userDefinedLock )
310
+ return;
311
+
312
+ lockRatio = enable;
313
+ }
314
+
315
+ // Undefined. User changed lock value.
316
+ else {
317
+ var width = widthField.getValue(),
318
+ height;
319
+
320
+ userDefinedLock = true;
321
+ lockRatio = !lockRatio;
322
+
323
+ // Automatically adjust height to width to match
324
+ // the original ratio (based on dom- dimensions).
325
+ if ( lockRatio && width ) {
326
+ height = domHeight / domWidth * width;
327
+
328
+ if ( !isNaN( height ) )
329
+ heightField.setValue( Math.round( height ) );
330
+ }
331
+ }
332
+
333
+ lockButton[ lockRatio ? 'removeClass' : 'addClass' ]( 'cke_btn_unlocked' );
334
+ lockButton.setAttribute( 'aria-checked', lockRatio );
335
+
336
+ // Ratio button hc presentation - WHITE SQUARE / BLACK SQUARE
337
+ if ( CKEDITOR.env.hc ) {
338
+ var icon = lockButton.getChild( 0 );
339
+ icon.setHtml( lockRatio ? CKEDITOR.env.ie ? '\u25A0' : '\u25A3' : CKEDITOR.env.ie ? '\u25A1' : '\u25A2' );
340
+ }
341
+ }
342
+
343
+ function toggleDimensions( enable ) {
344
+ var method = enable ? 'enable' : 'disable';
345
+
346
+ widthField[ method ]();
347
+ heightField[ method ]();
348
+ }
349
+
350
+ var srcBoxChildren = [
351
+ {
352
+ id: 'src',
353
+ type: 'text',
354
+ label: commonLang.url,
355
+ onKeyup: onChangeSrc,
356
+ onChange: onChangeSrc,
357
+ setup: function( widget ) {
358
+ this.setValue( widget.data.src );
359
+ },
360
+ commit: function( widget ) {
361
+ widget.setData( 'src', this.getValue() );
362
+ },
363
+ validate: CKEDITOR.dialog.validate.notEmpty( lang.urlMissing )
364
+ }
365
+ ];
366
+
367
+ // Render the "Browse" button on demand to avoid an "empty" (hidden child)
368
+ // space in dialog layout that distorts the UI.
369
+ if ( hasFileBrowser ) {
370
+ srcBoxChildren.push( {
371
+ type: 'button',
372
+ id: 'browse',
373
+ // v-align with the 'txtUrl' field.
374
+ // TODO: We need something better than a fixed size here.
375
+ style: 'display:inline-block;margin-top:14px;',
376
+ align: 'center',
377
+ label: editor.lang.common.browseServer,
378
+ hidden: true,
379
+ filebrowser: 'info:src'
380
+ } );
381
+ }
382
+
383
+ return {
384
+ title: lang.title,
385
+ minWidth: 250,
386
+ minHeight: 100,
387
+ onLoad: function() {
388
+ // Create a "global" reference to the document for this dialog instance.
389
+ doc = this._.element.getDocument();
390
+
391
+ // Create a pre-loader used for determining dimensions of new images.
392
+ preLoader = createPreLoader();
393
+ },
394
+ onShow: function() {
395
+ // Create a "global" reference to edited widget.
396
+ widget = this.getModel();
397
+
398
+ // Create a "global" reference to widget's image.
399
+ image = widget.parts.image;
400
+
401
+ // Reset global variables.
402
+ srcChanged = userDefinedLock = lockRatio = false;
403
+
404
+ // Natural dimensions of the image.
405
+ natural = getNatural( image );
406
+
407
+ // Get the natural width of the image.
408
+ preLoadedWidth = domWidth = natural.width;
409
+
410
+ // Get the natural height of the image.
411
+ preLoadedHeight = domHeight = natural.height;
412
+ },
413
+ contents: [
414
+ {
415
+ id: 'info',
416
+ label: lang.infoTab,
417
+ elements: [
418
+ {
419
+ type: 'vbox',
420
+ padding: 0,
421
+ children: [
422
+ {
423
+ type: 'hbox',
424
+ widths: [ '100%' ],
425
+ className: 'cke_dialog_image_url',
426
+ children: srcBoxChildren
427
+ }
428
+ ]
429
+ },
430
+ {
431
+ id: 'alt',
432
+ type: 'text',
433
+ label: lang.alt,
434
+ setup: function( widget ) {
435
+ this.setValue( widget.data.alt );
436
+ },
437
+ commit: function( widget ) {
438
+ widget.setData( 'alt', this.getValue() );
439
+ },
440
+ validate: editor.config.image2_altRequired === true ? CKEDITOR.dialog.validate.notEmpty( lang.altMissing ) : null
441
+ },
442
+ {
443
+ type: 'hbox',
444
+ widths: [ '25%', '25%', '50%' ],
445
+ requiredContent: features.dimension.requiredContent,
446
+ children: [
447
+ {
448
+ type: 'text',
449
+ width: '45px',
450
+ id: 'width',
451
+ label: commonLang.width,
452
+ validate: validateDimension,
453
+ onKeyUp: onChangeDimension,
454
+ onLoad: function() {
455
+ widthField = this;
456
+ },
457
+ setup: function( widget ) {
458
+ this.setValue( widget.data.width );
459
+ },
460
+ commit: function( widget ) {
461
+ widget.setData( 'width', this.getValue() );
462
+ }
463
+ },
464
+ {
465
+ type: 'text',
466
+ id: 'height',
467
+ width: '45px',
468
+ label: commonLang.height,
469
+ validate: validateDimension,
470
+ onKeyUp: onChangeDimension,
471
+ onLoad: function() {
472
+ heightField = this;
473
+ },
474
+ setup: function( widget ) {
475
+ this.setValue( widget.data.height );
476
+ },
477
+ commit: function( widget ) {
478
+ widget.setData( 'height', this.getValue() );
479
+ }
480
+ },
481
+ {
482
+ id: 'lock',
483
+ type: 'html',
484
+ style: lockResetStyle,
485
+ onLoad: onLoadLockReset,
486
+ setup: function( widget ) {
487
+ toggleLockRatio( widget.data.lock );
488
+ },
489
+ commit: function( widget ) {
490
+ widget.setData( 'lock', lockRatio );
491
+ },
492
+ html: lockResetHtml
493
+ }
494
+ ]
495
+ },
496
+ {
497
+ type: 'hbox',
498
+ id: 'alignment',
499
+ requiredContent: features.align.requiredContent,
500
+ children: [
501
+ {
502
+ id: 'align',
503
+ type: 'radio',
504
+ items: [
505
+ [ commonLang.alignNone, 'none' ],
506
+ [ commonLang.left, 'left' ],
507
+ [ commonLang.center, 'center' ],
508
+ [ commonLang.right, 'right' ]
509
+ ],
510
+ label: commonLang.align,
511
+ setup: function( widget ) {
512
+ this.setValue( widget.data.align );
513
+ },
514
+ commit: function( widget ) {
515
+ widget.setData( 'align', this.getValue() );
516
+ }
517
+ }
518
+ ]
519
+ },
520
+ {
521
+ id: 'hasCaption',
522
+ type: 'checkbox',
523
+ label: lang.captioned,
524
+ requiredContent: features.caption.requiredContent,
525
+ setup: function( widget ) {
526
+ this.setValue( widget.data.hasCaption );
527
+ },
528
+ commit: function( widget ) {
529
+ widget.setData( 'hasCaption', this.getValue() );
530
+ }
531
+ }
532
+ ]
533
+ },
534
+ {
535
+ id: 'Upload',
536
+ hidden: true,
537
+ filebrowser: 'uploadButton',
538
+ label: lang.uploadTab,
539
+ elements: [
540
+ {
541
+ type: 'file',
542
+ id: 'upload',
543
+ label: lang.btnUpload,
544
+ style: 'height:40px'
545
+ },
546
+ {
547
+ type: 'fileButton',
548
+ id: 'uploadButton',
549
+ filebrowser: 'info:src',
550
+ label: lang.btnUpload,
551
+ 'for': [ 'Upload', 'upload' ]
552
+ }
553
+ ]
554
+ }
555
+ ]
556
+ };
557
+ } );
@@ -0,0 +1,21 @@
1
+ /*
2
+ Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ CKEditor 4 LTS ("Long Term Support") is available under the terms of the Extended Support Model.
4
+ */
5
+ CKEDITOR.plugins.setLang( 'image2', 'af', {
6
+ alt: 'Alternatiewe teks',
7
+ btnUpload: 'Stuur na bediener',
8
+ captioned: 'Captioned image', // MISSING
9
+ captionPlaceholder: 'Caption', // MISSING
10
+ infoTab: 'Afbeelding informasie',
11
+ lockRatio: 'Vaste proporsie',
12
+ menu: 'Afbeelding eienskappe',
13
+ pathName: 'image', // MISSING
14
+ pathNameCaption: 'caption', // MISSING
15
+ resetSize: 'Herstel grootte',
16
+ resizer: 'Click and drag to resize', // MISSING
17
+ title: 'Afbeelding eienskappe',
18
+ uploadTab: 'Oplaai',
19
+ urlMissing: 'Die URL na die afbeelding ontbreek.',
20
+ altMissing: 'Alternative text is missing.' // MISSING
21
+ } );
@@ -0,0 +1,21 @@
1
+ /*
2
+ Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ CKEditor 4 LTS ("Long Term Support") is available under the terms of the Extended Support Model.
4
+ */
5
+ CKEDITOR.plugins.setLang( 'image2', 'ar', {
6
+ alt: 'عنوان الصورة',
7
+ btnUpload: 'أرسلها للخادم',
8
+ captioned: 'صورة ذات اسم',
9
+ captionPlaceholder: 'تسمية',
10
+ infoTab: 'معلومات الصورة',
11
+ lockRatio: 'تناسق الحجم',
12
+ menu: 'خصائص الصورة',
13
+ pathName: 'صورة',
14
+ pathNameCaption: 'تسمية',
15
+ resetSize: 'إستعادة الحجم الأصلي',
16
+ resizer: 'انقر ثم اسحب للتحجيم',
17
+ title: 'خصائص الصورة',
18
+ uploadTab: 'رفع',
19
+ urlMissing: 'عنوان مصدر الصورة مفقود',
20
+ altMissing: 'Alternative text is missing.' // MISSING
21
+ } );
@@ -0,0 +1,21 @@
1
+ /*
2
+ Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ CKEditor 4 LTS ("Long Term Support") is available under the terms of the Extended Support Model.
4
+ */
5
+ CKEDITOR.plugins.setLang( 'image2', 'az', {
6
+ alt: 'Alternativ mətn',
7
+ btnUpload: 'Serverə göndər',
8
+ captioned: 'Altyazı olan şəkil',
9
+ captionPlaceholder: 'Altyazı',
10
+ infoTab: 'Şəkil haqqında məlumat',
11
+ lockRatio: 'Ölçülərin nisbəti saxla',
12
+ menu: 'Şəklin seçimləri',
13
+ pathName: 'Şəkil',
14
+ pathNameCaption: 'Altyazı',
15
+ resetSize: 'Ölçüləri qaytar',
16
+ resizer: 'Ölçülər dəyişmək üçün tıklayın və aparın',
17
+ title: 'Şəklin seçimləri',
18
+ uploadTab: 'Serverə yüklə',
19
+ urlMissing: 'Şəklin ünvanı yanlışdır.',
20
+ altMissing: 'Alternativ mətn tapılmayıb'
21
+ } );
@@ -0,0 +1,21 @@
1
+ /*
2
+ Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ CKEditor 4 LTS ("Long Term Support") is available under the terms of the Extended Support Model.
4
+ */
5
+ CKEDITOR.plugins.setLang( 'image2', 'bg', {
6
+ alt: 'Алтернативен текст',
7
+ btnUpload: 'Изпрати на сървъра',
8
+ captioned: 'Надписано изображение',
9
+ captionPlaceholder: 'Надпис',
10
+ infoTab: 'Изображение',
11
+ lockRatio: 'Заключване на съотношението',
12
+ menu: 'Настройки на изображението',
13
+ pathName: 'изображение',
14
+ pathNameCaption: 'надпис',
15
+ resetSize: 'Нулиране на размер',
16
+ resizer: 'Кликни и влачи, за да преоразмериш',
17
+ title: 'Настройки на изображението',
18
+ uploadTab: 'Качване',
19
+ urlMissing: 'URL адреса на изображението липсва.',
20
+ altMissing: 'Липсва алтернативен текст.'
21
+ } );
@@ -0,0 +1,21 @@
1
+ /*
2
+ Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ CKEditor 4 LTS ("Long Term Support") is available under the terms of the Extended Support Model.
4
+ */
5
+ CKEDITOR.plugins.setLang( 'image2', 'bn', {
6
+ alt: 'বিকল্প টেক্সট',
7
+ btnUpload: 'ইহাকে সার্ভারে প্রেরন কর',
8
+ captioned: 'Captioned image', // MISSING
9
+ captionPlaceholder: 'Caption', // MISSING
10
+ infoTab: 'ছবির তথ্য',
11
+ lockRatio: 'অনুপাত লক কর',
12
+ menu: 'ছবির প্রোপার্টি',
13
+ pathName: 'image', // MISSING
14
+ pathNameCaption: 'caption', // MISSING
15
+ resetSize: 'সাইজ পূর্বাবস্থায় ফিরিয়ে দাও',
16
+ resizer: 'Click and drag to resize', // MISSING
17
+ title: 'ছবির প্রোপার্টি',
18
+ uploadTab: 'আপলোড',
19
+ urlMissing: 'Image source URL is missing.', // MISSING
20
+ altMissing: 'Alternative text is missing.' // MISSING
21
+ } );
@@ -0,0 +1,21 @@
1
+ /*
2
+ Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ CKEditor 4 LTS ("Long Term Support") is available under the terms of the Extended Support Model.
4
+ */
5
+ CKEDITOR.plugins.setLang( 'image2', 'bs', {
6
+ alt: 'Tekst na slici',
7
+ btnUpload: 'Šalji na server',
8
+ captioned: 'Captioned image', // MISSING
9
+ captionPlaceholder: 'Caption', // MISSING
10
+ infoTab: 'Info slike',
11
+ lockRatio: 'Zakljuèaj odnos',
12
+ menu: 'Svojstva slike',
13
+ pathName: 'image', // MISSING
14
+ pathNameCaption: 'caption', // MISSING
15
+ resetSize: 'Resetuj dimenzije',
16
+ resizer: 'Click and drag to resize', // MISSING
17
+ title: 'Svojstva slike',
18
+ uploadTab: 'Šalji',
19
+ urlMissing: 'Image source URL is missing.', // MISSING
20
+ altMissing: 'Alternative text is missing.' // MISSING
21
+ } );