sunny-html-editor 1.2.3 → 1.2.5
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/README.md +4 -3
- package/html-editor.js +12 -5
- package/package.json +2 -15
package/README.md
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
# Sunny HTML Editor
|
|
2
2
|
|
|
3
|
-
軽量WYSIWYG
|
|
3
|
+
軽量WYSIWYGエディタ。Markdown変換対応。
|
|
4
4
|
|
|
5
5
|
## バージョン履歴
|
|
6
6
|
|
|
7
|
+
- **1.2.5** - サイドバー開閉時の横スクロールバー問題を修正
|
|
8
|
+
- **1.2.4** - h1改行を最初の「-」「_」のみに限定
|
|
7
9
|
- **1.2.3** - サイドバーh1の改行(br)維持を修正
|
|
8
10
|
- **1.2.2** - パッケージ修正
|
|
9
11
|
- **1.2.1** - h1の「_」区切り改行対応
|
|
10
|
-
- **1.2.0** - Markdown
|
|
11
|
-
- **1.1.0** - ツールバー・コンテキストメニュー自動生成、外部ライブラリ遅延読み込み
|
|
12
|
+
- **1.2.0** - Markdown変換機能追加
|
|
12
13
|
|
|
13
14
|
## ライセンス
|
|
14
15
|
|
package/html-editor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sunny HTML Editor - 軽量WYSIWYGエディタ
|
|
3
|
-
* @version 1.2.
|
|
3
|
+
* @version 1.2.5
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// ========== HTML生成関数 ==========
|
|
@@ -190,7 +190,7 @@ function convertMarkdownToHtml(md) {
|
|
|
190
190
|
if (/^#\s+/.test(line) && !/^##/.test(line)) {
|
|
191
191
|
line = line.replace(/^#\s+(.+)$/, function(match, title) {
|
|
192
192
|
docTitle = title;
|
|
193
|
-
var displayTitle = title.replace(/\s*[-_]\s
|
|
193
|
+
var displayTitle = title.replace(/\s*[-_]\s*/, '<br>');
|
|
194
194
|
return '<h1>' + displayTitle + '</h1>';
|
|
195
195
|
});
|
|
196
196
|
}
|
|
@@ -895,7 +895,10 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
|
895
895
|
if (newWidth < 200) newWidth = 200;
|
|
896
896
|
if (newWidth > 400) newWidth = 400;
|
|
897
897
|
s.style.width = newWidth + 'px';
|
|
898
|
-
if (main)
|
|
898
|
+
if (main) {
|
|
899
|
+
main.style.marginLeft = newWidth + 'px';
|
|
900
|
+
main.style.width = 'calc(100% - ' + newWidth + 'px)';
|
|
901
|
+
}
|
|
899
902
|
updateResizerPosition();
|
|
900
903
|
});
|
|
901
904
|
|
|
@@ -917,7 +920,10 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
|
917
920
|
resizerHtml = r.outerHTML;
|
|
918
921
|
s.remove();
|
|
919
922
|
r.remove();
|
|
920
|
-
if (main)
|
|
923
|
+
if (main) {
|
|
924
|
+
main.style.marginLeft = '0';
|
|
925
|
+
main.style.width = '100%';
|
|
926
|
+
}
|
|
921
927
|
sidebarExists = false;
|
|
922
928
|
} else if (!sidebarExists && main) {
|
|
923
929
|
main.insertAdjacentHTML('beforebegin', sidebarHtml);
|
|
@@ -925,6 +931,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
|
925
931
|
var newSidebar = document.querySelector('.sidebar');
|
|
926
932
|
if (newSidebar) newSidebar.style.width = savedWidth + 'px';
|
|
927
933
|
main.style.marginLeft = savedWidth + 'px';
|
|
934
|
+
main.style.width = 'calc(100% - ' + savedWidth + 'px)';
|
|
928
935
|
setupResizer();
|
|
929
936
|
updateResizerPosition();
|
|
930
937
|
updateActiveLink();
|
|
@@ -958,7 +965,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
|
958
965
|
if (sidebarH1) {
|
|
959
966
|
var h1Html = mainH1.innerHTML;
|
|
960
967
|
if (!/<br[\s\/]*>/i.test(h1Html)) {
|
|
961
|
-
h1Html = mainH1.textContent.replace(/\s*[-_]\s
|
|
968
|
+
h1Html = mainH1.textContent.replace(/\s*[-_]\s*/, '<br>');
|
|
962
969
|
}
|
|
963
970
|
sidebarH1.innerHTML = h1Html;
|
|
964
971
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sunny-html-editor",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "軽量WYSIWYGエディタ - 既存のHTMLに編集機能を後付けで追加、Markdown変換対応",
|
|
5
5
|
"main": "html-editor.js",
|
|
6
6
|
"files": [
|
|
@@ -16,18 +16,5 @@
|
|
|
16
16
|
"markdown"
|
|
17
17
|
],
|
|
18
18
|
"author": "",
|
|
19
|
-
"license": "MIT"
|
|
20
|
-
"optionalDependencies": {
|
|
21
|
-
"exceljs": "^4.3.0",
|
|
22
|
-
"jspdf": "^2.5.1",
|
|
23
|
-
"html2canvas": "^1.4.1"
|
|
24
|
-
},
|
|
25
|
-
"repository": {
|
|
26
|
-
"type": "git",
|
|
27
|
-
"url": ""
|
|
28
|
-
},
|
|
29
|
-
"bugs": {
|
|
30
|
-
"url": ""
|
|
31
|
-
},
|
|
32
|
-
"homepage": ""
|
|
19
|
+
"license": "MIT"
|
|
33
20
|
}
|