@ckeditor/ckeditor5-image 47.6.1-alpha.1 → 48.0.0-alpha.0
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.
- package/LICENSE.md +1 -1
- package/ckeditor5-metadata.json +25 -25
- package/{src → dist}/autoimage.d.ts +4 -4
- package/{src → dist}/image/converters.d.ts +1 -1
- package/{src → dist}/image/imageblockediting.d.ts +2 -2
- package/{src → dist}/image/imageediting.d.ts +1 -1
- package/{src → dist}/image/imageinlineediting.d.ts +2 -2
- package/{src → dist}/image/imageloadobserver.d.ts +1 -1
- package/{src → dist}/image/imageplaceholder.d.ts +1 -1
- package/{src → dist}/image/imagetypecommand.d.ts +2 -2
- package/{src → dist}/image/insertimagecommand.d.ts +2 -2
- package/{src → dist}/image/replaceimagesourcecommand.d.ts +2 -2
- package/{src → dist}/image/ui/utils.d.ts +2 -2
- package/{src → dist}/image/utils.d.ts +2 -2
- package/{src → dist}/image.d.ts +1 -1
- package/{src → dist}/imageblock.d.ts +2 -2
- package/{src → dist}/imagecaption/imagecaptionediting.d.ts +2 -2
- package/{src → dist}/imagecaption/imagecaptionui.d.ts +1 -1
- package/{src → dist}/imagecaption/imagecaptionutils.d.ts +2 -2
- package/{src → dist}/imagecaption/toggleimagecaptioncommand.d.ts +1 -1
- package/{src → dist}/imagecaption.d.ts +1 -1
- package/{src → dist}/imageconfig.d.ts +25 -16
- package/{src → dist}/imageinline.d.ts +2 -2
- package/{src → dist}/imageinsert/imageinsertui.d.ts +3 -3
- package/{src → dist}/imageinsert/imageinsertviaurlui.d.ts +2 -2
- package/{src → dist}/imageinsert/ui/imageinsertformview.d.ts +2 -2
- package/{src → dist}/imageinsert/ui/imageinserturlview.d.ts +2 -2
- package/{src → dist}/imageinsert.d.ts +1 -1
- package/{src → dist}/imageinsertviaurl.d.ts +1 -1
- package/{src → dist}/imageresize/imagecustomresizeui.d.ts +2 -2
- package/{src → dist}/imageresize/imageresizebuttons.d.ts +1 -1
- package/{src → dist}/imageresize/imageresizeediting.d.ts +1 -1
- package/{src → dist}/imageresize/imageresizehandles.d.ts +2 -2
- package/{src → dist}/imageresize/resizeimagecommand.d.ts +1 -1
- package/{src → dist}/imageresize/ui/imagecustomresizeformview.d.ts +2 -4
- package/{src → dist}/imageresize/utils/getselectedimageeditornodes.d.ts +2 -2
- package/{src → dist}/imageresize/utils/getselectedimagepossibleresizerange.d.ts +1 -1
- package/{src → dist}/imageresize/utils/getselectedimagewidthinunits.d.ts +1 -1
- package/{src → dist}/imageresize.d.ts +1 -1
- package/{src → dist}/imagesizeattributes.d.ts +1 -1
- package/{src → dist}/imagestyle/converters.d.ts +2 -2
- package/{src → dist}/imagestyle/imagestylecommand.d.ts +2 -2
- package/{src → dist}/imagestyle/imagestyleediting.d.ts +1 -1
- package/{src → dist}/imagestyle/imagestyleui.d.ts +1 -1
- package/{src → dist}/imagestyle/utils.d.ts +1 -1
- package/{src → dist}/imagestyle.d.ts +1 -1
- package/{src → dist}/imagetextalternative/imagetextalternativecommand.d.ts +1 -1
- package/{src → dist}/imagetextalternative/imagetextalternativeediting.d.ts +1 -1
- package/{src → dist}/imagetextalternative/imagetextalternativeui.d.ts +2 -2
- package/{src → dist}/imagetextalternative/ui/textalternativeformview.d.ts +2 -4
- package/{src → dist}/imagetextalternative.d.ts +1 -1
- package/{src → dist}/imagetoolbar.d.ts +2 -2
- package/{src → dist}/imageupload/imageuploadediting.d.ts +5 -5
- package/{src → dist}/imageupload/imageuploadprogress.d.ts +1 -1
- package/{src → dist}/imageupload/imageuploadui.d.ts +1 -1
- package/{src → dist}/imageupload/uploadimagecommand.d.ts +2 -2
- package/{src → dist}/imageupload/utils.d.ts +1 -1
- package/{src → dist}/imageupload.d.ts +1 -1
- package/{src → dist}/imageutils.d.ts +2 -2
- package/dist/index-content.css +97 -100
- package/dist/index-editor.css +313 -190
- package/dist/index.css +388 -458
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/{src → dist}/pictureediting.d.ts +1 -1
- package/package.json +29 -53
- package/build/image.js +0 -5
- package/build/translations/af.js +0 -1
- package/build/translations/ar.js +0 -1
- package/build/translations/ast.js +0 -1
- package/build/translations/az.js +0 -1
- package/build/translations/be.js +0 -1
- package/build/translations/bg.js +0 -1
- package/build/translations/bn.js +0 -1
- package/build/translations/bs.js +0 -1
- package/build/translations/ca.js +0 -1
- package/build/translations/cs.js +0 -1
- package/build/translations/da.js +0 -1
- package/build/translations/de-ch.js +0 -1
- package/build/translations/de.js +0 -1
- package/build/translations/el.js +0 -1
- package/build/translations/en-au.js +0 -1
- package/build/translations/en-gb.js +0 -1
- package/build/translations/eo.js +0 -1
- package/build/translations/es-co.js +0 -1
- package/build/translations/es.js +0 -1
- package/build/translations/et.js +0 -1
- package/build/translations/eu.js +0 -1
- package/build/translations/fa.js +0 -1
- package/build/translations/fi.js +0 -1
- package/build/translations/fr.js +0 -1
- package/build/translations/gl.js +0 -1
- package/build/translations/gu.js +0 -1
- package/build/translations/he.js +0 -1
- package/build/translations/hi.js +0 -1
- package/build/translations/hr.js +0 -1
- package/build/translations/hu.js +0 -1
- package/build/translations/hy.js +0 -1
- package/build/translations/id.js +0 -1
- package/build/translations/it.js +0 -1
- package/build/translations/ja.js +0 -1
- package/build/translations/jv.js +0 -1
- package/build/translations/kk.js +0 -1
- package/build/translations/km.js +0 -1
- package/build/translations/kn.js +0 -1
- package/build/translations/ko.js +0 -1
- package/build/translations/ku.js +0 -1
- package/build/translations/lt.js +0 -1
- package/build/translations/lv.js +0 -1
- package/build/translations/ms.js +0 -1
- package/build/translations/nb.js +0 -1
- package/build/translations/ne.js +0 -1
- package/build/translations/nl.js +0 -1
- package/build/translations/no.js +0 -1
- package/build/translations/oc.js +0 -1
- package/build/translations/pl.js +0 -1
- package/build/translations/pt-br.js +0 -1
- package/build/translations/pt.js +0 -1
- package/build/translations/ro.js +0 -1
- package/build/translations/ru.js +0 -1
- package/build/translations/si.js +0 -1
- package/build/translations/sk.js +0 -1
- package/build/translations/sl.js +0 -1
- package/build/translations/sq.js +0 -1
- package/build/translations/sr-latn.js +0 -1
- package/build/translations/sr.js +0 -1
- package/build/translations/sv.js +0 -1
- package/build/translations/th.js +0 -1
- package/build/translations/ti.js +0 -1
- package/build/translations/tk.js +0 -1
- package/build/translations/tr.js +0 -1
- package/build/translations/tt.js +0 -1
- package/build/translations/ug.js +0 -1
- package/build/translations/uk.js +0 -1
- package/build/translations/ur.js +0 -1
- package/build/translations/uz.js +0 -1
- package/build/translations/vi.js +0 -1
- package/build/translations/zh-cn.js +0 -1
- package/build/translations/zh.js +0 -1
- package/lang/contexts.json +0 -48
- package/lang/translations/af.po +0 -196
- package/lang/translations/ar.po +0 -196
- package/lang/translations/ast.po +0 -196
- package/lang/translations/az.po +0 -196
- package/lang/translations/be.po +0 -196
- package/lang/translations/bg.po +0 -196
- package/lang/translations/bn.po +0 -196
- package/lang/translations/bs.po +0 -196
- package/lang/translations/ca.po +0 -196
- package/lang/translations/cs.po +0 -196
- package/lang/translations/da.po +0 -196
- package/lang/translations/de-ch.po +0 -196
- package/lang/translations/de.po +0 -196
- package/lang/translations/el.po +0 -196
- package/lang/translations/en-au.po +0 -196
- package/lang/translations/en-gb.po +0 -196
- package/lang/translations/en.po +0 -196
- package/lang/translations/eo.po +0 -196
- package/lang/translations/es-co.po +0 -196
- package/lang/translations/es.po +0 -196
- package/lang/translations/et.po +0 -196
- package/lang/translations/eu.po +0 -196
- package/lang/translations/fa.po +0 -196
- package/lang/translations/fi.po +0 -196
- package/lang/translations/fr.po +0 -196
- package/lang/translations/gl.po +0 -196
- package/lang/translations/gu.po +0 -196
- package/lang/translations/he.po +0 -196
- package/lang/translations/hi.po +0 -196
- package/lang/translations/hr.po +0 -196
- package/lang/translations/hu.po +0 -196
- package/lang/translations/hy.po +0 -196
- package/lang/translations/id.po +0 -196
- package/lang/translations/it.po +0 -196
- package/lang/translations/ja.po +0 -196
- package/lang/translations/jv.po +0 -196
- package/lang/translations/kk.po +0 -196
- package/lang/translations/km.po +0 -196
- package/lang/translations/kn.po +0 -196
- package/lang/translations/ko.po +0 -196
- package/lang/translations/ku.po +0 -196
- package/lang/translations/lt.po +0 -196
- package/lang/translations/lv.po +0 -196
- package/lang/translations/ms.po +0 -196
- package/lang/translations/nb.po +0 -196
- package/lang/translations/ne.po +0 -196
- package/lang/translations/nl.po +0 -196
- package/lang/translations/no.po +0 -196
- package/lang/translations/oc.po +0 -196
- package/lang/translations/pl.po +0 -196
- package/lang/translations/pt-br.po +0 -196
- package/lang/translations/pt.po +0 -196
- package/lang/translations/ro.po +0 -196
- package/lang/translations/ru.po +0 -196
- package/lang/translations/si.po +0 -196
- package/lang/translations/sk.po +0 -196
- package/lang/translations/sl.po +0 -196
- package/lang/translations/sq.po +0 -196
- package/lang/translations/sr-latn.po +0 -196
- package/lang/translations/sr.po +0 -196
- package/lang/translations/sv.po +0 -196
- package/lang/translations/th.po +0 -196
- package/lang/translations/ti.po +0 -196
- package/lang/translations/tk.po +0 -196
- package/lang/translations/tr.po +0 -196
- package/lang/translations/tt.po +0 -196
- package/lang/translations/ug.po +0 -196
- package/lang/translations/uk.po +0 -196
- package/lang/translations/ur.po +0 -196
- package/lang/translations/uz.po +0 -196
- package/lang/translations/vi.po +0 -196
- package/lang/translations/zh-cn.po +0 -196
- package/lang/translations/zh.po +0 -196
- package/src/augmentation.js +0 -5
- package/src/autoimage.js +0 -148
- package/src/image/converters.js +0 -236
- package/src/image/imageblockediting.js +0 -159
- package/src/image/imageediting.js +0 -69
- package/src/image/imageinlineediting.js +0 -178
- package/src/image/imageloadobserver.js +0 -52
- package/src/image/imageplaceholder.js +0 -119
- package/src/image/imagetypecommand.js +0 -84
- package/src/image/insertimagecommand.js +0 -125
- package/src/image/replaceimagesourcecommand.js +0 -75
- package/src/image/ui/utils.js +0 -46
- package/src/image/utils.js +0 -125
- package/src/image.js +0 -44
- package/src/imageblock.js +0 -44
- package/src/imagecaption/imagecaptionediting.js +0 -238
- package/src/imagecaption/imagecaptionui.js +0 -68
- package/src/imagecaption/imagecaptionutils.js +0 -68
- package/src/imagecaption/toggleimagecaptioncommand.js +0 -138
- package/src/imagecaption.js +0 -36
- package/src/imageconfig.js +0 -5
- package/src/imageinline.js +0 -44
- package/src/imageinsert/imageinsertui.js +0 -216
- package/src/imageinsert/imageinsertviaurlui.js +0 -175
- package/src/imageinsert/ui/imageinsertformview.js +0 -117
- package/src/imageinsert/ui/imageinserturlview.js +0 -102
- package/src/imageinsert.js +0 -43
- package/src/imageinsertviaurl.js +0 -41
- package/src/imageresize/imagecustomresizeui.js +0 -177
- package/src/imageresize/imageresizebuttons.js +0 -303
- package/src/imageresize/imageresizeediting.js +0 -206
- package/src/imageresize/imageresizehandles.js +0 -118
- package/src/imageresize/resizeimagecommand.js +0 -63
- package/src/imageresize/ui/imagecustomresizeformview.js +0 -264
- package/src/imageresize/utils/getselectedimageeditornodes.js +0 -25
- package/src/imageresize/utils/getselectedimagepossibleresizerange.js +0 -33
- package/src/imageresize/utils/getselectedimagewidthinunits.js +0 -42
- package/src/imageresize/utils/tryparsedimensionwithunit.js +0 -58
- package/src/imageresize.js +0 -38
- package/src/imagesizeattributes.js +0 -163
- package/src/imagestyle/converters.js +0 -118
- package/src/imagestyle/imagestylecommand.js +0 -117
- package/src/imagestyle/imagestyleediting.js +0 -127
- package/src/imagestyle/imagestyleui.js +0 -198
- package/src/imagestyle/utils.js +0 -333
- package/src/imagestyle.js +0 -42
- package/src/imagetextalternative/imagetextalternativecommand.js +0 -44
- package/src/imagetextalternative/imagetextalternativeediting.js +0 -41
- package/src/imagetextalternative/imagetextalternativeui.js +0 -183
- package/src/imagetextalternative/ui/textalternativeformview.js +0 -193
- package/src/imagetextalternative.js +0 -39
- package/src/imagetoolbar.js +0 -63
- package/src/imageupload/imageuploadediting.js +0 -482
- package/src/imageupload/imageuploadprogress.js +0 -222
- package/src/imageupload/imageuploadui.js +0 -135
- package/src/imageupload/uploadimagecommand.js +0 -110
- package/src/imageupload/utils.js +0 -114
- package/src/imageupload.js +0 -42
- package/src/imageutils.js +0 -309
- package/src/index.js +0 -67
- package/src/pictureediting.js +0 -136
- package/theme/image.css +0 -143
- package/theme/imagecaption.css +0 -53
- package/theme/imagecustomresizeform.css +0 -4
- package/theme/imageinsert.css +0 -14
- package/theme/imageplaceholder.css +0 -10
- package/theme/imageresize.css +0 -53
- package/theme/imagestyle.css +0 -120
- package/theme/imageuploadicon.css +0 -23
- package/theme/imageuploadloader.css +0 -18
- package/theme/imageuploadprogress.css +0 -19
- package/theme/textalternativeform.css +0 -4
- /package/{src → dist}/augmentation.d.ts +0 -0
- /package/{src → dist}/imageresize/utils/tryparsedimensionwithunit.d.ts +0 -0
- /package/{src → dist}/index.d.ts +0 -0
package/lang/translations/zh.po
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
2
|
-
#
|
|
3
|
-
# Want to contribute to this file? Submit your changes via a GitHub Pull Request.
|
|
4
|
-
#
|
|
5
|
-
# Check out the official contributor's guide:
|
|
6
|
-
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
|
7
|
-
#
|
|
8
|
-
msgid ""
|
|
9
|
-
msgstr ""
|
|
10
|
-
"Language: zh_TW\n"
|
|
11
|
-
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
12
|
-
"Content-Type: text/plain; charset=UTF-8\n"
|
|
13
|
-
|
|
14
|
-
msgctxt "The label for the image widget."
|
|
15
|
-
msgid "image widget"
|
|
16
|
-
msgstr "圖片小工具"
|
|
17
|
-
|
|
18
|
-
msgctxt "The label for the image style button that wraps text around the image."
|
|
19
|
-
msgid "Wrap text"
|
|
20
|
-
msgstr "文繞圖"
|
|
21
|
-
|
|
22
|
-
msgctxt "The label for the image style button that breaks the text around the image."
|
|
23
|
-
msgid "Break text"
|
|
24
|
-
msgstr "上及下"
|
|
25
|
-
|
|
26
|
-
msgctxt "The label for the image style button that places the image inside the line of text."
|
|
27
|
-
msgid "In line"
|
|
28
|
-
msgstr "行中"
|
|
29
|
-
|
|
30
|
-
msgctxt "The label for the Side image option."
|
|
31
|
-
msgid "Side image"
|
|
32
|
-
msgstr "側邊圖片"
|
|
33
|
-
|
|
34
|
-
msgctxt "The label for the Full size image option."
|
|
35
|
-
msgid "Full size image"
|
|
36
|
-
msgstr "完整尺寸圖片"
|
|
37
|
-
|
|
38
|
-
msgctxt "The label for the Left aligned image option."
|
|
39
|
-
msgid "Left aligned image"
|
|
40
|
-
msgstr "向左對齊圖片"
|
|
41
|
-
|
|
42
|
-
msgctxt "The label for the Centered image option."
|
|
43
|
-
msgid "Centered image"
|
|
44
|
-
msgstr "置中圖片"
|
|
45
|
-
|
|
46
|
-
msgctxt "The label for the Right aligned image option."
|
|
47
|
-
msgid "Right aligned image"
|
|
48
|
-
msgstr "向右對齊圖片"
|
|
49
|
-
|
|
50
|
-
msgctxt "The label for the Change image text alternative button."
|
|
51
|
-
msgid "Change image text alternative"
|
|
52
|
-
msgstr "修改圖片的替代文字"
|
|
53
|
-
|
|
54
|
-
msgctxt "The label for the image text alternative input."
|
|
55
|
-
msgid "Text alternative"
|
|
56
|
-
msgstr "替代文字"
|
|
57
|
-
|
|
58
|
-
msgctxt "The placeholder text for the image caption displayed when the caption is empty."
|
|
59
|
-
msgid "Enter image caption"
|
|
60
|
-
msgstr "輸入圖片說明"
|
|
61
|
-
|
|
62
|
-
msgctxt "The label for the insert image toolbar button."
|
|
63
|
-
msgid "Insert image"
|
|
64
|
-
msgstr "插入圖片"
|
|
65
|
-
|
|
66
|
-
msgctxt "The label for the replace image toolbar button."
|
|
67
|
-
msgid "Replace image"
|
|
68
|
-
msgstr "替換圖片"
|
|
69
|
-
|
|
70
|
-
msgctxt "The label for the upload image from computer toolbar button with visible label in insert image dropdown."
|
|
71
|
-
msgid "Upload from computer"
|
|
72
|
-
msgstr "從電腦上傳"
|
|
73
|
-
|
|
74
|
-
msgctxt "The label for the replace image by upload from computer toolbar button with visible label in insert image dropdown."
|
|
75
|
-
msgid "Replace from computer"
|
|
76
|
-
msgstr "從電腦替換"
|
|
77
|
-
|
|
78
|
-
msgctxt "The label for the upload image from computer toolbar button."
|
|
79
|
-
msgid "Upload image from computer"
|
|
80
|
-
msgstr "從電腦上傳圖片"
|
|
81
|
-
|
|
82
|
-
msgctxt "The label for the upload image from computer menu bar button (standalone button)."
|
|
83
|
-
msgid "Image from computer"
|
|
84
|
-
msgstr "來自電腦的圖片"
|
|
85
|
-
|
|
86
|
-
msgctxt "The label for the upload image from computer menu bar button (inside 'Image' menu)."
|
|
87
|
-
msgid "From computer"
|
|
88
|
-
msgstr "從電腦"
|
|
89
|
-
|
|
90
|
-
msgctxt "The label for the replace image by upload from computer toolbar button."
|
|
91
|
-
msgid "Replace image from computer"
|
|
92
|
-
msgstr "從電腦替換圖片"
|
|
93
|
-
|
|
94
|
-
msgctxt "The title of the notification displayed when upload fails."
|
|
95
|
-
msgid "Upload failed"
|
|
96
|
-
msgstr "上傳失敗"
|
|
97
|
-
|
|
98
|
-
msgctxt "The title of the notification displayed when there is no permission to upload assets."
|
|
99
|
-
msgid "You have no image upload permissions."
|
|
100
|
-
msgstr "您沒有圖片上傳權限。"
|
|
101
|
-
|
|
102
|
-
msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget."
|
|
103
|
-
msgid "Image toolbar"
|
|
104
|
-
msgstr "圖片工具"
|
|
105
|
-
|
|
106
|
-
msgctxt "The label used for the dropdown in the image toolbar containing defined resize options."
|
|
107
|
-
msgid "Resize image"
|
|
108
|
-
msgstr "縮放圖片"
|
|
109
|
-
|
|
110
|
-
msgctxt "The label used for the standalone resize options buttons in the image toolbar."
|
|
111
|
-
msgid "Resize image to %0"
|
|
112
|
-
msgstr "縮放圖片到 %0"
|
|
113
|
-
|
|
114
|
-
msgctxt "The accessibility label of the standalone image resize reset option button in the image toolbar for screen readers."
|
|
115
|
-
msgid "Resize image to the original size"
|
|
116
|
-
msgstr "縮放圖片到原始尺寸"
|
|
117
|
-
|
|
118
|
-
msgctxt "The label for image resize balloon input."
|
|
119
|
-
msgid "Resize image (in %0)"
|
|
120
|
-
msgstr "調整圖片大小(單位為 %0)"
|
|
121
|
-
|
|
122
|
-
msgctxt "The default label for the resize option that resets the size of the image."
|
|
123
|
-
msgid "Original"
|
|
124
|
-
msgstr "原始圖片"
|
|
125
|
-
|
|
126
|
-
msgctxt "The accessibility label of the standalone image resize custom option button in the image toolbar for screen readers."
|
|
127
|
-
msgid "Custom image size"
|
|
128
|
-
msgstr "自訂圖片大小"
|
|
129
|
-
|
|
130
|
-
msgctxt "The label for the resize option that allows user to enter custom size of the image."
|
|
131
|
-
msgid "Custom"
|
|
132
|
-
msgstr "自訂"
|
|
133
|
-
|
|
134
|
-
msgctxt "The accessibility label of the image resize dropdown for screen readers."
|
|
135
|
-
msgid "Image resize list"
|
|
136
|
-
msgstr "圖片縮放清單"
|
|
137
|
-
|
|
138
|
-
msgctxt "The input label for the Insert image via URL form."
|
|
139
|
-
msgid "Insert image via URL"
|
|
140
|
-
msgstr "使用連結插入圖片"
|
|
141
|
-
|
|
142
|
-
msgctxt "The label for the insert image via url dropdown button."
|
|
143
|
-
msgid "Insert via URL"
|
|
144
|
-
msgstr "透過網址插入"
|
|
145
|
-
|
|
146
|
-
msgctxt "The label for the insert image via url menu bar button (standalone button)."
|
|
147
|
-
msgid "Image via URL"
|
|
148
|
-
msgstr "透過網址插入圖片"
|
|
149
|
-
|
|
150
|
-
msgctxt "The label for the insert image via url menu bar button (inside 'Image' menu)."
|
|
151
|
-
msgid "Via URL"
|
|
152
|
-
msgstr "透過網址"
|
|
153
|
-
|
|
154
|
-
msgctxt "The input label for the Insert image via URL form for a pre-existing image."
|
|
155
|
-
msgid "Update image URL"
|
|
156
|
-
msgstr "更新圖片連結"
|
|
157
|
-
|
|
158
|
-
msgctxt "Text used by screen readers do describe an image when the image has no text alternative."
|
|
159
|
-
msgid "Caption for the image"
|
|
160
|
-
msgstr "影像的標題"
|
|
161
|
-
|
|
162
|
-
msgctxt "Text used by screen readers do describe an image when there is a text alternative available, e.g. 'Caption for image: this is a description of the image.'"
|
|
163
|
-
msgid "Caption for image: %0"
|
|
164
|
-
msgstr "影像標題:%0"
|
|
165
|
-
|
|
166
|
-
msgctxt "Text used as error label when user submitted custom image resize form with blank value."
|
|
167
|
-
msgid "The value must not be empty."
|
|
168
|
-
msgstr "數值不得為空白。"
|
|
169
|
-
|
|
170
|
-
msgctxt "Text used as error label when user submitted custom image resize form with incorrect value."
|
|
171
|
-
msgid "The value should be a plain number."
|
|
172
|
-
msgstr "數值應為純數字。"
|
|
173
|
-
|
|
174
|
-
msgctxt "Aria status message indicating that the image is being uploaded. Example: 'Uploading image'."
|
|
175
|
-
msgid "Uploading image"
|
|
176
|
-
msgstr "正在上傳圖片"
|
|
177
|
-
|
|
178
|
-
msgctxt "Aria status message indicating that the image has been uploaded successfully. Example: 'Image upload complete'."
|
|
179
|
-
msgid "Image upload complete"
|
|
180
|
-
msgstr "圖片上傳完成"
|
|
181
|
-
|
|
182
|
-
msgctxt "Aria status message indicating that an error has occurred during image upload. Example: 'Error during image upload'."
|
|
183
|
-
msgid "Error during image upload"
|
|
184
|
-
msgstr "圖片上傳期間發生錯誤"
|
|
185
|
-
|
|
186
|
-
msgctxt "Label for the widget inserted by the image feature (as in 'insert image')"
|
|
187
|
-
msgid "Image"
|
|
188
|
-
msgstr "圖片"
|
|
189
|
-
|
|
190
|
-
msgctxt "The label for the header of the image resize balloon."
|
|
191
|
-
msgid "Image Resize"
|
|
192
|
-
msgstr "圖片調整大小"
|
|
193
|
-
|
|
194
|
-
msgctxt "The label of the input field for the text alternative of the image."
|
|
195
|
-
msgid "Text Alternative"
|
|
196
|
-
msgstr "文字替代"
|
package/src/augmentation.js
DELETED
package/src/autoimage.js
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module image/autoimage
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { Clipboard } from 'ckeditor5/src/clipboard.js';
|
|
10
|
-
import { ModelLivePosition, ModelLiveRange } from 'ckeditor5/src/engine.js';
|
|
11
|
-
import { Undo } from 'ckeditor5/src/undo.js';
|
|
12
|
-
import { Delete } from 'ckeditor5/src/typing.js';
|
|
13
|
-
import { global } from 'ckeditor5/src/utils.js';
|
|
14
|
-
import { ImageUtils } from './imageutils.js';
|
|
15
|
-
// Implements the pattern: http(s)://(www.)example.com/path/to/resource.ext?query=params&maybe=too.
|
|
16
|
-
const IMAGE_URL_REGEXP = new RegExp(String(/^(http(s)?:\/\/)?[\w-]+\.[\w.~:/[\]@!$&'()*+,;=%-]+/.source +
|
|
17
|
-
/\.(jpg|jpeg|png|gif|ico|webp|JPG|JPEG|PNG|GIF|ICO|WEBP)/.source +
|
|
18
|
-
/(\?[\w.~:/[\]@!$&'()*+,;=%-]*)?/.source +
|
|
19
|
-
/(#[\w.~:/[\]@!$&'()*+,;=%-]*)?$/.source));
|
|
20
|
-
/**
|
|
21
|
-
* The auto-image plugin. It recognizes image links in the pasted content and embeds
|
|
22
|
-
* them shortly after they are injected into the document.
|
|
23
|
-
*/
|
|
24
|
-
export class AutoImage extends Plugin {
|
|
25
|
-
/**
|
|
26
|
-
* @inheritDoc
|
|
27
|
-
*/
|
|
28
|
-
static get requires() {
|
|
29
|
-
return [Clipboard, ImageUtils, Undo, Delete];
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* @inheritDoc
|
|
33
|
-
*/
|
|
34
|
-
static get pluginName() {
|
|
35
|
-
return 'AutoImage';
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* @inheritDoc
|
|
39
|
-
*/
|
|
40
|
-
static get isOfficialPlugin() {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* The paste–to–embed `setTimeout` ID. Stored as a property to allow
|
|
45
|
-
* cleaning of the timeout.
|
|
46
|
-
*/
|
|
47
|
-
_timeoutId;
|
|
48
|
-
/**
|
|
49
|
-
* The position where the `<imageBlock>` element will be inserted after the timeout,
|
|
50
|
-
* determined each time a new content is pasted into the document.
|
|
51
|
-
*/
|
|
52
|
-
_positionToInsert;
|
|
53
|
-
/**
|
|
54
|
-
* @inheritDoc
|
|
55
|
-
*/
|
|
56
|
-
constructor(editor) {
|
|
57
|
-
super(editor);
|
|
58
|
-
this._timeoutId = null;
|
|
59
|
-
this._positionToInsert = null;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* @inheritDoc
|
|
63
|
-
*/
|
|
64
|
-
init() {
|
|
65
|
-
const editor = this.editor;
|
|
66
|
-
const modelDocument = editor.model.document;
|
|
67
|
-
const clipboardPipeline = editor.plugins.get('ClipboardPipeline');
|
|
68
|
-
// We need to listen on `Clipboard#inputTransformation` because we need to save positions of selection.
|
|
69
|
-
// After pasting, the content between those positions will be checked for a URL that could be transformed
|
|
70
|
-
// into an image.
|
|
71
|
-
this.listenTo(clipboardPipeline, 'inputTransformation', () => {
|
|
72
|
-
const firstRange = modelDocument.selection.getFirstRange();
|
|
73
|
-
const leftLivePosition = ModelLivePosition.fromPosition(firstRange.start);
|
|
74
|
-
leftLivePosition.stickiness = 'toPrevious';
|
|
75
|
-
const rightLivePosition = ModelLivePosition.fromPosition(firstRange.end);
|
|
76
|
-
rightLivePosition.stickiness = 'toNext';
|
|
77
|
-
modelDocument.once('change:data', () => {
|
|
78
|
-
this._embedImageBetweenPositions(leftLivePosition, rightLivePosition);
|
|
79
|
-
leftLivePosition.detach();
|
|
80
|
-
rightLivePosition.detach();
|
|
81
|
-
}, { priority: 'high' });
|
|
82
|
-
});
|
|
83
|
-
editor.commands.get('undo').on('execute', () => {
|
|
84
|
-
if (this._timeoutId) {
|
|
85
|
-
global.window.clearTimeout(this._timeoutId);
|
|
86
|
-
this._positionToInsert.detach();
|
|
87
|
-
this._timeoutId = null;
|
|
88
|
-
this._positionToInsert = null;
|
|
89
|
-
}
|
|
90
|
-
}, { priority: 'high' });
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Analyzes the part of the document between provided positions in search for a URL representing an image.
|
|
94
|
-
* When the URL is found, it is automatically converted into an image.
|
|
95
|
-
*
|
|
96
|
-
* @param leftPosition Left position of the selection.
|
|
97
|
-
* @param rightPosition Right position of the selection.
|
|
98
|
-
*/
|
|
99
|
-
_embedImageBetweenPositions(leftPosition, rightPosition) {
|
|
100
|
-
const editor = this.editor;
|
|
101
|
-
// TODO: Use a marker instead of ModelLiveRange & LivePositions.
|
|
102
|
-
const urlRange = new ModelLiveRange(leftPosition, rightPosition);
|
|
103
|
-
const walker = urlRange.getWalker({ ignoreElementEnd: true });
|
|
104
|
-
const selectionAttributes = Object.fromEntries(editor.model.document.selection.getAttributes());
|
|
105
|
-
const imageUtils = this.editor.plugins.get('ImageUtils');
|
|
106
|
-
let src = '';
|
|
107
|
-
for (const node of walker) {
|
|
108
|
-
if (node.item.is('$textProxy')) {
|
|
109
|
-
src += node.item.data;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
src = src.trim();
|
|
113
|
-
// If the URL does not match the image URL regexp, let's skip that.
|
|
114
|
-
if (!src.match(IMAGE_URL_REGEXP)) {
|
|
115
|
-
urlRange.detach();
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
// Position will not be available in the `setTimeout` function so let's clone it.
|
|
119
|
-
this._positionToInsert = ModelLivePosition.fromPosition(leftPosition);
|
|
120
|
-
// This action mustn't be executed if undo was called between pasting and auto-embedding.
|
|
121
|
-
this._timeoutId = setTimeout(() => {
|
|
122
|
-
// Do nothing if image element cannot be inserted at the current position.
|
|
123
|
-
// See https://github.com/ckeditor/ckeditor5/issues/2763.
|
|
124
|
-
// Condition must be checked after timeout - pasting may take place on an element, replacing it. The final position matters.
|
|
125
|
-
const imageCommand = editor.commands.get('insertImage');
|
|
126
|
-
if (!imageCommand.isEnabled) {
|
|
127
|
-
urlRange.detach();
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
editor.model.change(writer => {
|
|
131
|
-
this._timeoutId = null;
|
|
132
|
-
writer.remove(urlRange);
|
|
133
|
-
urlRange.detach();
|
|
134
|
-
let insertionPosition;
|
|
135
|
-
// Check if the position where the element should be inserted is still valid.
|
|
136
|
-
// Otherwise leave it as undefined to use the logic of insertImage().
|
|
137
|
-
if (this._positionToInsert.root.rootName !== '$graveyard') {
|
|
138
|
-
insertionPosition = this._positionToInsert.toPosition();
|
|
139
|
-
}
|
|
140
|
-
imageUtils.insertImage({ ...selectionAttributes, src }, insertionPosition);
|
|
141
|
-
this._positionToInsert.detach();
|
|
142
|
-
this._positionToInsert = null;
|
|
143
|
-
});
|
|
144
|
-
const deletePlugin = editor.plugins.get('Delete');
|
|
145
|
-
deletePlugin.requestUndoOnBackspace();
|
|
146
|
-
}, 100);
|
|
147
|
-
}
|
|
148
|
-
}
|
package/src/image/converters.js
DELETED
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
import { first } from 'ckeditor5/src/utils.js';
|
|
6
|
-
/**
|
|
7
|
-
* Returns a function that converts the image view representation:
|
|
8
|
-
*
|
|
9
|
-
* ```html
|
|
10
|
-
* <figure class="image"><img src="..." alt="..."></img></figure>
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* to the model representation:
|
|
14
|
-
*
|
|
15
|
-
* ```html
|
|
16
|
-
* <imageBlock src="..." alt="..."></imageBlock>
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* The entire content of the `<figure>` element except the first `<img>` is being converted as children
|
|
20
|
-
* of the `<imageBlock>` model element.
|
|
21
|
-
*
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
export function upcastImageFigure(imageUtils) {
|
|
25
|
-
const converter = (evt, data, conversionApi) => {
|
|
26
|
-
// Do not convert if this is not an "image figure".
|
|
27
|
-
if (!conversionApi.consumable.test(data.viewItem, { name: true, classes: 'image' })) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
// Find an image element inside the figure element.
|
|
31
|
-
const viewImage = imageUtils.findViewImgElement(data.viewItem);
|
|
32
|
-
// Do not convert if image element is absent or was already converted.
|
|
33
|
-
if (!viewImage || !conversionApi.consumable.test(viewImage, { name: true })) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
// Consume the figure to prevent other converters from processing it again.
|
|
37
|
-
conversionApi.consumable.consume(data.viewItem, { name: true, classes: 'image' });
|
|
38
|
-
// Convert view image to model image.
|
|
39
|
-
const conversionResult = conversionApi.convertItem(viewImage, data.modelCursor);
|
|
40
|
-
// Get image element from conversion result.
|
|
41
|
-
const modelImage = first(conversionResult.modelRange.getItems());
|
|
42
|
-
// When image wasn't successfully converted then finish conversion.
|
|
43
|
-
if (!modelImage) {
|
|
44
|
-
// Revert consumed figure so other features can convert it.
|
|
45
|
-
conversionApi.consumable.revert(data.viewItem, { name: true, classes: 'image' });
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
// Convert rest of the figure element's children as an image children.
|
|
49
|
-
conversionApi.convertChildren(data.viewItem, modelImage);
|
|
50
|
-
conversionApi.updateConversionResult(modelImage, data);
|
|
51
|
-
};
|
|
52
|
-
return dispatcher => {
|
|
53
|
-
dispatcher.on('element:figure', converter);
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Returns a function that converts the image view representation:
|
|
58
|
-
*
|
|
59
|
-
* ```html
|
|
60
|
-
* <picture><source ... /><source ... />...<img ... /></picture>
|
|
61
|
-
* ```
|
|
62
|
-
*
|
|
63
|
-
* to the model representation as the `sources` attribute:
|
|
64
|
-
*
|
|
65
|
-
* ```html
|
|
66
|
-
* <image[Block|Inline] ... sources="..."></image[Block|Inline]>
|
|
67
|
-
* ```
|
|
68
|
-
*
|
|
69
|
-
* @internal
|
|
70
|
-
*/
|
|
71
|
-
export function upcastPicture(imageUtils) {
|
|
72
|
-
const sourceAttributeNames = ['srcset', 'media', 'type', 'sizes'];
|
|
73
|
-
const converter = (evt, data, conversionApi) => {
|
|
74
|
-
const pictureViewElement = data.viewItem;
|
|
75
|
-
// Do not convert <picture> if already consumed.
|
|
76
|
-
if (!conversionApi.consumable.test(pictureViewElement, { name: true })) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
const sources = new Map();
|
|
80
|
-
// Collect all <source /> elements attribute values.
|
|
81
|
-
for (const childSourceElement of pictureViewElement.getChildren()) {
|
|
82
|
-
if (childSourceElement.is('element', 'source')) {
|
|
83
|
-
const attributes = {};
|
|
84
|
-
for (const name of sourceAttributeNames) {
|
|
85
|
-
if (childSourceElement.hasAttribute(name)) {
|
|
86
|
-
// Don't collect <source /> attribute if already consumed somewhere else.
|
|
87
|
-
if (conversionApi.consumable.test(childSourceElement, { attributes: name })) {
|
|
88
|
-
attributes[name] = childSourceElement.getAttribute(name);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
if (Object.keys(attributes).length) {
|
|
93
|
-
sources.set(childSourceElement, attributes);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
const imgViewElement = imageUtils.findViewImgElement(pictureViewElement);
|
|
98
|
-
// Don't convert when a picture has no <img/> inside (it is broken).
|
|
99
|
-
if (!imgViewElement) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
let modelImage = data.modelCursor.parent;
|
|
103
|
-
// - In case of an inline image (cursor parent in a <paragraph>), the <img/> must be converted right away
|
|
104
|
-
// because no converter handled it yet and otherwise there would be no model element to set the sources attribute on.
|
|
105
|
-
// - In case of a block image, the <figure class="image"> converter (in ImageBlockEditing) converts the
|
|
106
|
-
// <img/> right away on its own and the modelCursor is already inside an imageBlock and there's nothing special
|
|
107
|
-
// to do here.
|
|
108
|
-
if (!modelImage.is('element', 'imageBlock')) {
|
|
109
|
-
const conversionResult = conversionApi.convertItem(imgViewElement, data.modelCursor);
|
|
110
|
-
// Set image range as conversion result.
|
|
111
|
-
data.modelRange = conversionResult.modelRange;
|
|
112
|
-
// Continue conversion where image conversion ends.
|
|
113
|
-
data.modelCursor = conversionResult.modelCursor;
|
|
114
|
-
modelImage = first(conversionResult.modelRange.getItems());
|
|
115
|
-
}
|
|
116
|
-
conversionApi.consumable.consume(pictureViewElement, { name: true });
|
|
117
|
-
// Consume only these <source/> attributes that were actually collected and will be passed on
|
|
118
|
-
// to the image model element.
|
|
119
|
-
for (const [sourceElement, attributes] of sources) {
|
|
120
|
-
conversionApi.consumable.consume(sourceElement, { attributes: Object.keys(attributes) });
|
|
121
|
-
}
|
|
122
|
-
if (sources.size) {
|
|
123
|
-
conversionApi.writer.setAttribute('sources', Array.from(sources.values()), modelImage);
|
|
124
|
-
}
|
|
125
|
-
// Convert rest of the <picture> children as an image children. Other converters may want to consume them.
|
|
126
|
-
conversionApi.convertChildren(pictureViewElement, modelImage);
|
|
127
|
-
};
|
|
128
|
-
return dispatcher => {
|
|
129
|
-
dispatcher.on('element:picture', converter);
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Converter used to convert the `srcset` model image attribute to the `srcset` and `sizes` attributes in the view.
|
|
134
|
-
*
|
|
135
|
-
* @internal
|
|
136
|
-
* @param imageType The type of the image.
|
|
137
|
-
*/
|
|
138
|
-
export function downcastSrcsetAttribute(imageUtils, imageType) {
|
|
139
|
-
const converter = (evt, data, conversionApi) => {
|
|
140
|
-
if (!conversionApi.consumable.consume(data.item, evt.name)) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
const writer = conversionApi.writer;
|
|
144
|
-
const element = conversionApi.mapper.toViewElement(data.item);
|
|
145
|
-
const img = imageUtils.findViewImgElement(element);
|
|
146
|
-
if (data.attributeNewValue === null) {
|
|
147
|
-
writer.removeAttribute('srcset', img);
|
|
148
|
-
writer.removeAttribute('sizes', img);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
if (data.attributeNewValue) {
|
|
152
|
-
writer.setAttribute('srcset', data.attributeNewValue, img);
|
|
153
|
-
// Always outputting `100vw`. See https://github.com/ckeditor/ckeditor5-image/issues/2.
|
|
154
|
-
writer.setAttribute('sizes', '100vw', img);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
return dispatcher => {
|
|
159
|
-
dispatcher.on(`attribute:srcset:${imageType}`, converter);
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Converts the `source` model attribute to the `<picture><source /><source />...<img /></picture>`
|
|
164
|
-
* view structure.
|
|
165
|
-
*
|
|
166
|
-
* @internal
|
|
167
|
-
*/
|
|
168
|
-
export function downcastSourcesAttribute(imageUtils) {
|
|
169
|
-
const converter = (evt, data, conversionApi) => {
|
|
170
|
-
if (!conversionApi.consumable.consume(data.item, evt.name)) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
const viewWriter = conversionApi.writer;
|
|
174
|
-
const element = conversionApi.mapper.toViewElement(data.item);
|
|
175
|
-
const imgElement = imageUtils.findViewImgElement(element);
|
|
176
|
-
const attributeNewValue = data.attributeNewValue;
|
|
177
|
-
if (attributeNewValue && attributeNewValue.length) {
|
|
178
|
-
// Collect all wrapping attribute elements.
|
|
179
|
-
const attributeElements = [];
|
|
180
|
-
let viewElement = imgElement.parent;
|
|
181
|
-
while (viewElement && viewElement.is('attributeElement')) {
|
|
182
|
-
const parentElement = viewElement.parent;
|
|
183
|
-
viewWriter.unwrap(viewWriter.createRangeOn(imgElement), viewElement);
|
|
184
|
-
attributeElements.unshift(viewElement);
|
|
185
|
-
viewElement = parentElement;
|
|
186
|
-
}
|
|
187
|
-
const hasPictureElement = imgElement.parent.is('element', 'picture');
|
|
188
|
-
// Reuse existing <picture> element (ckeditor5#17192) or create a new one.
|
|
189
|
-
const pictureElement = hasPictureElement ? imgElement.parent : viewWriter.createContainerElement('picture', null);
|
|
190
|
-
if (!hasPictureElement) {
|
|
191
|
-
viewWriter.insert(viewWriter.createPositionBefore(imgElement), pictureElement);
|
|
192
|
-
}
|
|
193
|
-
viewWriter.remove(viewWriter.createRangeIn(pictureElement));
|
|
194
|
-
viewWriter.insert(viewWriter.createPositionAt(pictureElement, 'end'), attributeNewValue.map(sourceAttributes => {
|
|
195
|
-
return viewWriter.createEmptyElement('source', sourceAttributes);
|
|
196
|
-
}));
|
|
197
|
-
viewWriter.move(viewWriter.createRangeOn(imgElement), viewWriter.createPositionAt(pictureElement, 'end'));
|
|
198
|
-
// Apply collected attribute elements over the new picture element.
|
|
199
|
-
for (const attributeElement of attributeElements) {
|
|
200
|
-
viewWriter.wrap(viewWriter.createRangeOn(pictureElement), attributeElement);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
// Both setting "sources" to an empty array and removing the attribute should unwrap the <img />.
|
|
204
|
-
// Unwrap once if the latter followed the former, though.
|
|
205
|
-
else if (imgElement.parent.is('element', 'picture')) {
|
|
206
|
-
const pictureElement = imgElement.parent;
|
|
207
|
-
viewWriter.move(viewWriter.createRangeOn(imgElement), viewWriter.createPositionBefore(pictureElement));
|
|
208
|
-
viewWriter.remove(pictureElement);
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
return dispatcher => {
|
|
212
|
-
dispatcher.on('attribute:sources:imageBlock', converter);
|
|
213
|
-
dispatcher.on('attribute:sources:imageInline', converter);
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Converter used to convert a given image attribute from the model to the view.
|
|
218
|
-
*
|
|
219
|
-
* @internal
|
|
220
|
-
* @param imageType The type of the image.
|
|
221
|
-
* @param attributeKey The name of the attribute to convert.
|
|
222
|
-
*/
|
|
223
|
-
export function downcastImageAttribute(imageUtils, imageType, attributeKey) {
|
|
224
|
-
const converter = (evt, data, conversionApi) => {
|
|
225
|
-
if (!conversionApi.consumable.consume(data.item, evt.name)) {
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
const viewWriter = conversionApi.writer;
|
|
229
|
-
const element = conversionApi.mapper.toViewElement(data.item);
|
|
230
|
-
const img = imageUtils.findViewImgElement(element);
|
|
231
|
-
viewWriter.setAttribute(data.attributeKey, data.attributeNewValue || '', img);
|
|
232
|
-
};
|
|
233
|
-
return dispatcher => {
|
|
234
|
-
dispatcher.on(`attribute:${attributeKey}:${imageType}`, converter);
|
|
235
|
-
};
|
|
236
|
-
}
|