suneditor 2.45.0 → 2.46.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "suneditor",
3
- "version": "2.45.0",
4
- "description": "Pure JavaScript based WYSIWYG web editor",
3
+ "version": "2.46.0",
4
+ "description": "Vanilla javascript based WYSIWYG web editor, with no dependencies",
5
5
  "author": "JiHong.Lee",
6
6
  "license": "MIT",
7
7
  "main": "src/suneditor.js",
@@ -30,12 +30,14 @@
30
30
  ],
31
31
  "devDependencies": {
32
32
  "@babel/core": "^7.21.3",
33
+ "@octokit/rest": "^20.1.0",
33
34
  "@webpack-cli/init": "^0.2.2",
34
35
  "babel-loader": "^8.1.0",
35
36
  "clean-webpack-plugin": "^0.1.19",
36
37
  "codemirror": "^5.61.0",
37
38
  "css-loader": "^1.0.1",
38
39
  "csstype": "^2.6.13",
40
+ "dotenv": "^16.4.5",
39
41
  "file-loader": "^2.0.0",
40
42
  "html-webpack-plugin": "^3.2.0",
41
43
  "jasmine": "^2.99.0",
@@ -44,7 +46,7 @@
44
46
  "karma": "^6.3.19",
45
47
  "karma-chrome-launcher": "^2.2.0",
46
48
  "karma-jasmine": "^1.1.2",
47
- "katex": "^0.11.1",
49
+ "katex": "^0.16.10",
48
50
  "mini-css-extract-plugin": "^0.4.5",
49
51
  "optimize-css-assets-webpack-plugin": "^5.0.4",
50
52
  "url-loader": "^1.1.2",
@@ -53,7 +55,6 @@
53
55
  "webpack-dev-server": "^3.11.0",
54
56
  "webpack-merge": "^4.2.2"
55
57
  },
56
- "dependencies": {},
57
58
  "keywords": [
58
59
  "wysiwyg",
59
60
  "wysiwyg editor",
@@ -0,0 +1,5 @@
1
+ import { Lang } from './Lang';
2
+
3
+ declare const fa: Lang;
4
+
5
+ export default fa;
package/src/lang/fa.js ADDED
@@ -0,0 +1,188 @@
1
+ /*
2
+ * wysiwyg web editor
3
+ *
4
+ * suneditor.js
5
+ * Copyright 2017 JiHong Lee.
6
+ * MIT license.
7
+ */
8
+ 'use strict';
9
+
10
+ (function (global, factory) {
11
+ if (typeof module === 'object' && typeof module.exports === 'object') {
12
+ module.exports = global.document ?
13
+ factory(global, true) :
14
+ function (w) {
15
+ if (!w.document) {
16
+ throw new Error('SUNEDITOR_LANG a window with a document');
17
+ }
18
+ return factory(w);
19
+ };
20
+ } else {
21
+ factory(global);
22
+ }
23
+ }(typeof window !== 'undefined' ? window : this, function (window, noGlobal) {
24
+ const lang = {
25
+ code: 'fa',
26
+ toolbar: {
27
+ default: 'پیش فرض',
28
+ save: 'ذخیره',
29
+ font: 'فونت',
30
+ formats: 'قالب‌ها',
31
+ fontSize: 'اندازه‌ی فونت',
32
+ bold: 'پررنگ کردن',
33
+ underline: 'زیرخطدار کردن',
34
+ italic: 'کج کردن',
35
+ strike: 'خط میان‌دار کردن',
36
+ subscript: 'نوشتن به صورت زیر متن',
37
+ superscript: 'نوشتن به صورت بالای متن',
38
+ removeFormat: 'حذف قالب',
39
+ fontColor: 'رنگ پیش زمینه',
40
+ hiliteColor: 'رنگ پس‌زمینه',
41
+ indent: 'جلو بردن',
42
+ outdent: 'عقب بردن',
43
+ align: 'چیدمان',
44
+ alignLeft: 'چپ‌چین',
45
+ alignRight: 'راست‌چین',
46
+ alignCenter: 'وسط‌چین',
47
+ alignJustify: 'همتراز از هر دو سمت',
48
+ list: 'لیست',
49
+ orderList: 'لیست شمارشی',
50
+ unorderList: 'لیست گلوله‌ای',
51
+ horizontalRule: 'درج خط افقی',
52
+ hr_solid: 'تو پر',
53
+ hr_dotted: 'نقطه‌چین',
54
+ hr_dashed: 'خط تیره',
55
+ table: 'درج جدول',
56
+ link: 'درج لینک',
57
+ math: 'درج فرمول ریاضی',
58
+ image: 'درج تصویر',
59
+ video: 'درج ویدئو',
60
+ audio: 'درج صوت',
61
+ fullScreen: 'تمام صفحه',
62
+ showBlocks: 'نمایش بلاک‌بندی',
63
+ codeView: 'مشاهده‌ی کُد HTML',
64
+ undo: 'برگرداندن تغییر',
65
+ redo: 'تکرار تغییر',
66
+ preview: 'پیش نمایش',
67
+ print: 'چاپ',
68
+ tag_p: 'پاراگراف',
69
+ tag_div: 'عادی (DIV)',
70
+ tag_h: 'هدر',
71
+ tag_blockquote: 'نقل قول',
72
+ tag_pre: 'کُد',
73
+ template: 'درج محتوا بر اساس الگو',
74
+ lineHeight: 'ارتفاع خط',
75
+ paragraphStyle: 'استایل پاراگراف',
76
+ textStyle: 'استایل متن',
77
+ imageGallery: 'گالری تصاویر',
78
+ dir_ltr: 'چپ به راست',
79
+ dir_rtl: 'راست به چپ',
80
+ mention: 'ذکر کردن'
81
+ },
82
+ dialogBox: {
83
+ linkBox: {
84
+ title: 'درج لینک',
85
+ url: 'آدرس لینک',
86
+ text: 'عنوان لینک',
87
+ newWindowCheck: 'در پنجره‌ی جدیدی باز شود',
88
+ downloadLinkCheck: 'لینک دانلود',
89
+ bookmark: 'نشان'
90
+ },
91
+ mathBox: {
92
+ title: 'فرمول ریاضی',
93
+ inputLabel: 'تعریف فرمول',
94
+ fontSizeLabel: 'اندازه‌ی فونت',
95
+ previewLabel: 'پیش نمایش'
96
+ },
97
+ imageBox: {
98
+ title: 'درج تصویر',
99
+ file: 'انتخاب فایل',
100
+ url: 'آدرس Url',
101
+ altText: 'متن جایگزین'
102
+ },
103
+ videoBox: {
104
+ title: 'درج ویدئو',
105
+ file: 'انتخاب فایل',
106
+ url: 'آدرس Url ویدئو, YouTube/Vimeo'
107
+ },
108
+ audioBox: {
109
+ title: 'درج صوت',
110
+ file: 'انتخاب فایل',
111
+ url: 'آدرس Url'
112
+ },
113
+ browser: {
114
+ tags: 'تگ‌ها',
115
+ search: 'جستجو',
116
+ },
117
+ caption: 'توضیح',
118
+ close: 'بستن',
119
+ submitButton: 'درج',
120
+ revertButton: 'برگرداندن تغییرات',
121
+ proportion: 'محدودیت اندازه',
122
+ basic: 'چیدمان پیش فرض',
123
+ left: 'چپ',
124
+ right: 'راست',
125
+ center: 'وسط',
126
+ width: 'پهنا',
127
+ height: 'ارتفاع',
128
+ size: 'اندازه',
129
+ ratio: 'نسبت'
130
+ },
131
+ controller: {
132
+ edit: 'ویرایش',
133
+ unlink: 'حذف لینک',
134
+ remove: 'حذف',
135
+ insertRowAbove: 'درج سطر در بالا',
136
+ insertRowBelow: 'درج سطر در پایین',
137
+ deleteRow: 'حذف سطر',
138
+ insertColumnBefore: 'درج یک ستون به عقب',
139
+ insertColumnAfter: 'درج یک ستون در جلو',
140
+ deleteColumn: 'حذف ستون',
141
+ fixedColumnWidth: 'اندازه ستون ثابت',
142
+ resize100: 'اندازه‌ی 100%',
143
+ resize75: 'اندازه‌ی 75%',
144
+ resize50: 'اندازه‌ی 50%',
145
+ resize25: 'اندازه‌ی 25%',
146
+ autoSize: 'اندازه‌ی خودکار',
147
+ mirrorHorizontal: 'بر عکس کردن در جهت افقی',
148
+ mirrorVertical: 'بر عکس کردن در جهت عمودی',
149
+ rotateLeft: 'دوران به چپ',
150
+ rotateRight: 'دوران به راست',
151
+ maxSize: 'حداکثر اندازه',
152
+ minSize: 'حداقل اندازه',
153
+ tableHeader: 'هدر جدول',
154
+ mergeCells: 'ادغام خانه‌ها',
155
+ splitCells: 'تقسیم خانه به چند خانه',
156
+ HorizontalSplit: 'تقسیم در جهت افقی',
157
+ VerticalSplit: 'تقسیم در جهت عمودی'
158
+ },
159
+ menu: {
160
+ spaced: 'فضادار',
161
+ bordered: 'لبه‌دار',
162
+ neon: 'نئونی',
163
+ translucent: 'نیمه شفاف',
164
+ shadow: 'سایه',
165
+ code: 'کُد'
166
+ }
167
+ };
168
+
169
+ if (typeof noGlobal === typeof undefined) {
170
+ if (!window.SUNEDITOR_LANG) {
171
+ Object.defineProperty(window, 'SUNEDITOR_LANG', {
172
+ enumerable: true,
173
+ writable: false,
174
+ configurable: false,
175
+ value: {}
176
+ });
177
+ }
178
+
179
+ Object.defineProperty(window.SUNEDITOR_LANG, 'fa', {
180
+ enumerable: true,
181
+ writable: true,
182
+ configurable: true,
183
+ value: lang
184
+ });
185
+ }
186
+
187
+ return lang;
188
+ }));
@@ -0,0 +1,5 @@
1
+ import { Lang } from "./Lang";
2
+
3
+ declare const tr: Lang;
4
+
5
+ export default tr;
package/src/lang/tr.js ADDED
@@ -0,0 +1,191 @@
1
+ /*
2
+ * wysiwyg web editor
3
+ *
4
+ * suneditor.js
5
+ * Copyright 2023 JiHong Lee.
6
+ *
7
+ * Turkish translation by worm-codes at github.com/worm-codes
8
+ *
9
+ * MIT license.
10
+ */
11
+ 'use strict';
12
+
13
+ (function (global, factory) {
14
+ if (typeof module === 'object' && typeof module.exports === 'object') {
15
+ module.exports = global.document ?
16
+ factory(global, true) :
17
+ function (w) {
18
+ if (!w.document) {
19
+ throw new Error('SUNEDITOR_LANG a window with a document');
20
+ }
21
+ return factory(w);
22
+ };
23
+ } else {
24
+ factory(global);
25
+ }
26
+ }(typeof window !== 'undefined' ? window : this, function (window, noGlobal) {
27
+ const lang = {
28
+ code: "tr",
29
+ toolbar: {
30
+ default: "Varsayılan",
31
+ save: "Kaydet",
32
+ font: "Yazı Tipi",
33
+ formats: "Biçimlendirmeler",
34
+ fontSize: "Boyut",
35
+ bold: "Kalın",
36
+ underline: "Alt Çizili",
37
+ italic: "İtalik",
38
+ strike: "Üstü Çizili",
39
+ subscript: "Alt Simge",
40
+ superscript: "Üst Simge",
41
+ removeFormat: "Biçimi Kaldır",
42
+ fontColor: "Yazı Tipi Rengi",
43
+ hiliteColor: "Vurgu Rengi",
44
+ indent: "Girinti",
45
+ outdent: "Girintiyi Azalt",
46
+ align: "Hizala",
47
+ alignLeft: "Sola Hizala",
48
+ alignRight: "Sağa Hizala",
49
+ alignCenter: "Ortaya Hizala",
50
+ alignJustify: "İki Yana Yasla",
51
+ list: "Liste",
52
+ orderList: "Sıralı Liste",
53
+ unorderList: "Sırasız Liste",
54
+ horizontalRule: "Yatay Çizgi",
55
+ hr_solid: "Düz",
56
+ hr_dotted: "Noktalı",
57
+ hr_dashed: "Kesikli",
58
+ table: "Tablo",
59
+ link: "Bağlantı",
60
+ math: "Matematik",
61
+ image: "Görsel",
62
+ video: "Video",
63
+ audio: "Ses",
64
+ fullScreen: "Tam Ekran",
65
+ showBlocks: "Blokları Göster",
66
+ codeView: "Kod Görünümü",
67
+ undo: "Geri Al",
68
+ redo: "İleri Al",
69
+ preview: "Önizleme",
70
+ print: "Yazdır",
71
+ tag_p: "Paragraf",
72
+ tag_div: "Normal (DIV)",
73
+ tag_h: "Başlık",
74
+ tag_blockquote: "Alıntı",
75
+ tag_pre: "Kod",
76
+ template: "Şablon",
77
+ lineHeight: "Satır Yüksekliği",
78
+ paragraphStyle: "Paragraf Stili",
79
+ textStyle: "Metin Stili",
80
+ imageGallery: "Görüntü Galerisi",
81
+ dir_ltr: "Soldan Sağa",
82
+ dir_rtl: "Sağdan Sola",
83
+ mention: "Belirtmek"
84
+ },
85
+ dialogBox: {
86
+ linkBox: {
87
+ title: "Bağlantı Ekle",
88
+ url: "Bağlantı URL'si",
89
+ text: "Görüntülenecek Metin",
90
+ newWindowCheck: "Yeni Pencerede Aç",
91
+ downloadLinkCheck: "Bağlantıyı İndir",
92
+ bookmark: "Bağlantıyı Yer İmlerine Ekle"
93
+ },
94
+ mathBox: {
95
+ title: "Matematik",
96
+ inputLabel: "Matematiksel Simgeler",
97
+ fontSizeLabel: "Yazı Tipi Boyutu",
98
+ previewLabel: "Önizleme"
99
+ },
100
+ imageBox: {
101
+ title: "Görüntü Ekle",
102
+ file: "Dosya Seç",
103
+ url: "Görüntü URL'si",
104
+ altText: "Alternatif Metin"
105
+ },
106
+ videoBox: {
107
+ title: "Video Ekle",
108
+ file: "Dosya Seç",
109
+ url: "Medya Ekleme URL'si (YouTube/Vimeo)"
110
+ },
111
+ audioBox: {
112
+ title: "Ses Ekle",
113
+ file: "Dosya Seç",
114
+ url: "Ses URL'si"
115
+ },
116
+ browser: {
117
+ tags: "Etiketler",
118
+ search: "Ara"
119
+ },
120
+ caption: "Açıklama Giriniz",
121
+ close: "Kapat",
122
+ submitButton: "Gönder",
123
+ revertButton: "Geri Dön",
124
+ proportion: "Orantıları Koru",
125
+ basic: "Temel",
126
+ left: "Sola",
127
+ right: "Sağa",
128
+ center: "Ortaya",
129
+ width: "Genişlik",
130
+ height: "Yükseklik",
131
+ size: "Boyut",
132
+ ratio: "Oran"
133
+ },
134
+ controller: {
135
+ edit: "Düzenle",
136
+ unlink: "Bağlantıyı Kaldır",
137
+ remove: "Kaldır",
138
+ insertRowAbove: "Satır Yukarı Ekle",
139
+ insertRowBelow: "Satır Aşağı Ekle",
140
+ deleteRow: "Satırı Sil",
141
+ insertColumnBefore: "Sütun Önce Ekle",
142
+ insertColumnAfter: "Sütun Sonrası Ekle",
143
+ deleteColumn: "Sütunu Sil",
144
+ fixedColumnWidth: "Sabit Sütun Genişliği",
145
+ resize100: "%100 Ölçeklendir",
146
+ resize75: "%75 Ölçeklendir",
147
+ resize50: "%50 Ölçeklendir",
148
+ resize25: "%25 Ölçeklendir",
149
+ autoSize: "Ölçeğe Otomatik Ayar",
150
+ mirrorHorizontal: "Düzlemsel Aynalama (Yatay)",
151
+ mirrorVertical: "Düzlemsel Aynalama (Dikey)",
152
+ rotateLeft: "Saat Yönünde Döndür",
153
+ rotateRight: "Saat Yönünün Tersine Döndür",
154
+ maxSize: "En Büyük Boyut",
155
+ minSize: "En Küçük Boyut",
156
+ tableHeader: "Tablo Başlığı",
157
+ mergeCells: "Hücreleri Birleştir",
158
+ splitCells: "Hücreleri Ayır",
159
+ HorizontalSplit: "Yatay Ayırma",
160
+ VerticalSplit: "Dikey Ayırma"
161
+ },
162
+ menu: {
163
+ spaced: "Aralıklı",
164
+ bordered: "Çerçeveli",
165
+ neon: "Neon",
166
+ translucent: "Yarı Saydam",
167
+ shadow: "Gölge",
168
+ code: "Kod"
169
+ }
170
+ };
171
+
172
+ if (typeof noGlobal === typeof undefined) {
173
+ if (!window.SUNEDITOR_LANG) {
174
+ Object.defineProperty(window, 'SUNEDITOR_LANG', {
175
+ enumerable: true,
176
+ writable: false,
177
+ configurable: false,
178
+ value: {}
179
+ });
180
+ }
181
+
182
+ Object.defineProperty(window.SUNEDITOR_LANG, 'tr', {
183
+ enumerable: true,
184
+ writable: true,
185
+ configurable: true,
186
+ value: lang
187
+ });
188
+ }
189
+
190
+ return lang;
191
+ }));
@@ -84,6 +84,12 @@ export default {
84
84
  const resize_back = doc.createElement('DIV');
85
85
  resize_back.className = 'se-resizing-back';
86
86
 
87
+ /// focus temp
88
+ const focusTemp = doc.createElement('INPUT');
89
+ focusTemp.tabIndex = -1;
90
+ focusTemp.style.width = '0 !important';
91
+ focusTemp.style.height = '0 !important';
92
+
87
93
  // toolbar container
88
94
  const toolbarContainer = options.toolbarContainer;
89
95
  if (toolbarContainer) {
@@ -109,6 +115,7 @@ export default {
109
115
  relative.appendChild(line_breaker);
110
116
  relative.appendChild(line_breaker_t);
111
117
  relative.appendChild(line_breaker_b);
118
+ relative.appendChild(focusTemp);
112
119
  if (resizing_bar && !resizingBarContainer) relative.appendChild(resizing_bar);
113
120
  top_div.appendChild(relative);
114
121
 
@@ -135,7 +142,8 @@ export default {
135
142
  _lineBreaker_b: line_breaker_b,
136
143
  _resizeBack: resize_back,
137
144
  _stickyDummy: sticky_dummy,
138
- _arrow: arrow
145
+ _arrow: arrow,
146
+ _focusTemp: focusTemp
139
147
  },
140
148
  options: options,
141
149
  plugins: tool_bar.plugins,
@@ -307,6 +315,7 @@ export default {
307
315
 
308
316
  if (!options.iframe) {
309
317
  wysiwygDiv.setAttribute('contenteditable', true);
318
+ wysiwygDiv.setAttribute('autocorrect', "off");
310
319
  wysiwygDiv.setAttribute('scrolling', 'auto');
311
320
  for (let key in options.iframeAttributes) {
312
321
  wysiwygDiv.setAttribute(key, options.iframeAttributes[key]);
@@ -407,6 +416,7 @@ export default {
407
416
  }
408
417
  options.plugins = plugins;
409
418
  /** Values */
419
+ options.strictMode = options.strictMode !== false;
410
420
  options.lang = options.lang || _defaultLang;
411
421
  options.value = typeof options.value === 'string' ? options.value : null;
412
422
  options.allowedClassNames = new util._w.RegExp((options.allowedClassNames && typeof options.allowedClassNames === 'string' ? options.allowedClassNames + '|' : '') + '^__se__|se-|katex');
@@ -40,7 +40,8 @@ const _Context = function (element, cons, options) {
40
40
  lineBreaker_b: cons._lineBreaker_b,
41
41
  resizeBackground: cons._resizeBack,
42
42
  _stickyDummy: cons._stickyDummy,
43
- _arrow: cons._arrow
43
+ _arrow: cons._arrow,
44
+ _focusTemp: cons._focusTemp
44
45
  },
45
46
  tool: {
46
47
  cover: cons._toolBar.querySelector('.se-toolbar-cover'),
package/src/lib/core.d.ts CHANGED
@@ -606,7 +606,7 @@ interface Core {
606
606
 
607
607
  /**
608
608
  * @description Remove events from document.
609
-   * When created as an Iframe, the event of the document inside the Iframe is also removed.
609
+ * When created as an Iframe, the event of the document inside the Iframe is also removed.
610
610
  * @param type Event type
611
611
  * @param listener Event listener
612
612
  */
@@ -920,6 +920,39 @@ export default class SunEditor {
920
920
  */
921
921
  onAudioUploadError: (errorMessage: string, result: any, core: Core) => boolean;
922
922
 
923
+ /**
924
+ * @description Called when the audio image delete before.
925
+ * "false" is returned, the event will be aborted.
926
+ * @param targetElement target element
927
+ * @param container target's container
928
+ * @param dataIndex target's dataIndex
929
+ * @param core Core object
930
+ * @returns {boolean|undefined}
931
+ */
932
+ onAudioDeleteBefore: (targetElement: Element, container: Element, dataIndex: number, core: Core) => boolean;
933
+
934
+ /**
935
+ * @description Called when the image image delete before.
936
+ * "false" is returned, the event will be aborted.
937
+ * @param targetElement target element
938
+ * @param container target's container
939
+ * @param dataIndex target's dataIndex
940
+ * @param core Core object
941
+ * @returns {boolean|undefined}
942
+ */
943
+ onImageDeleteBefore: (targetElement: Element, container: Element, dataIndex: number, core: Core) => boolean;
944
+
945
+ /**
946
+ * @description Called when the image image delete before.
947
+ * "false" is returned, the event will be aborted.
948
+ * @param targetElement target element
949
+ * @param container target's container
950
+ * @param dataIndex target's dataIndex
951
+ * @param core Core object
952
+ * @returns {boolean|undefined}
953
+ */
954
+ onVideoDeleteBefore: (targetElement: Element, container: Element, dataIndex: number, core: Core) => boolean;
955
+
923
956
  /**
924
957
  * @description Called when the audio upload failed
925
958
  * @param height Height after resized (px)