Skip to content

Commit 3e8e9a2

Browse files
committed
Merge branch 'development' into release
2 parents 58b83b6 + 1253711 commit 3e8e9a2

File tree

7 files changed

+40
-16
lines changed

7 files changed

+40
-16
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ body:
3535
description: Provide any additional context and screenshots here to help us solve this issue
3636
validations:
3737
required: false
38+
- type: input
39+
id: browserdetails
40+
attributes:
41+
label: Browser Details
42+
description: |
43+
If this is an issue that occurs when using the BookStack interface, please provide details of the browser used which presents the reported issue.
44+
placeholder: (eg. Firefox 97 (64-bit) on Windows 11)
45+
validations:
46+
required: false
3847
- type: input
3948
id: bsversion
4049
attributes:

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ body:
3333
attributes:
3434
label: Have you searched for an existing open/closed issue?
3535
description: |
36-
To help us keep these issues under control, please ensure you have first [searched our issue list](https://github.com/BookStackApp/BookStack/issues?q=is%3Aissue)
37-
for any existing issues that cover the fundemental benefit/goal of your request.
36+
To help us keep these issues under control, please ensure you have first [searched our issue list](https://github.com/BookStackApp/BookStack/issues?q=is%3Aissue) for any existing issues that cover the fundemental benefit/goal of your request.
3837
options:
3938
- label: I have searched for existing issues and none cover my fundemental request
4039
required: true

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Below is a high-level road map view for BookStack to provide a sense of directio
6363

6464
- **Platform REST API** - *(Most actions implemented, maturing)*
6565
- *A REST API covering, at minimum, control of core content models (Books, Chapters, Pages) for automation and platform extension.*
66-
- **Editor Alignment & Review** - *(Started)*
66+
- **Editor Alignment & Review** - *(In Progress)*
6767
- *Review the page editors with goal of achieving increased interoperability & feature parity while also considering collaborative editing potential.*
6868
- **Permission System Review**
6969
- *Improvement in how permissions are applied and a review of the efficiency of the permission & roles system.*

resources/js/components/code-editor.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,10 @@ class CodeEditor {
5959
this.languageInput.value = language;
6060
this.callback = callback;
6161

62-
this.show();
63-
this.updateEditorMode(language);
64-
65-
window.importVersioned('code').then(Code => {
66-
Code.setContent(this.editor, code);
67-
});
62+
this.show()
63+
.then(() => this.updateEditorMode(language))
64+
.then(() => window.importVersioned('code'))
65+
.then(Code => Code.setContent(this.editor, code));
6866
}
6967

7068
async show() {

resources/js/wysiwyg/plugin-codeeditor.js

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,35 @@ function defineCodeBlockCustomElement(editor) {
9191
}
9292

9393
connectedCallback() {
94+
const connectedTime = Date.now();
9495
if (this.cm) {
9596
return;
9697
}
9798

99+
this.cleanChildContent();
100+
98101
const container = this.shadowRoot.querySelector('.CodeMirrorContainer');
99-
importVersioned('code').then(Code => {
102+
const renderCodeMirror = (Code) => {
100103
this.cm = Code.wysiwygView(container, this.getContent(), this.getLanguage());
104+
Code.updateLayout(this.cm);
105+
};
106+
107+
window.importVersioned('code').then((Code) => {
108+
const timeout = (Date.now() - connectedTime < 20) ? 20 : 0;
109+
setTimeout(() => renderCodeMirror(Code), timeout);
101110
});
102111
}
112+
113+
cleanChildContent() {
114+
const pre = this.querySelector('pre');
115+
if (!pre) return;
116+
117+
for (const preChild of pre.childNodes) {
118+
if (preChild.nodeName === '#text' && preChild.textContent === '') {
119+
preChild.remove();
120+
}
121+
}
122+
}
103123
}
104124

105125
win.customElements.define('code-block', CodeBlockElement);
@@ -130,15 +150,13 @@ function register(editor, url) {
130150
} else {
131151
const textContent = editor.selection.getContent({format: 'text'});
132152
showPopup(editor, textContent, '', (newCode, newLang) => {
133-
const wrap = doc.createElement('code-block');
134153
const pre = doc.createElement('pre');
135154
const code = doc.createElement('code');
136155
code.classList.add(`language-${newLang}`);
137156
code.innerText = newCode;
138157
pre.append(code);
139-
wrap.append(pre);
140158

141-
editor.insertContent(wrap.outerHTML);
159+
editor.insertContent(pre.outerHTML);
142160
});
143161
}
144162
});
@@ -168,7 +186,7 @@ function register(editor, url) {
168186

169187
editor.parser.addNodeFilter('code-block', function(elms) {
170188
for (const el of elms) {
171-
el.attr('content-editable', 'false');
189+
el.attr('contenteditable', 'false');
172190
}
173191
});
174192

resources/lang/zh_CN/editor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
'list_numbered' => '有序列表',
5858
'indent_increase' => '增加缩进',
5959
'indent_decrease' => '减少缩进',
60-
'table' => '',
60+
'table' => '表格',
6161
'insert_image' => '插入图片',
6262
'insert_image_title' => '插入/编辑图片',
6363
'insert_link' => '插入/编辑链接',

resources/views/pages/edit.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@extends('layouts.base')
22

33
@section('head')
4-
<script src="{{ url('/libs/tinymce/tinymce.min.js?ver=4.9.4') }}" nonce="{{ $cspNonce }}"></script>
4+
<script src="{{ url('/libs/tinymce/tinymce.min.js?ver=5.10.2') }}" nonce="{{ $cspNonce }}"></script>
55
@stop
66

77
@section('body-class', 'flexbox')

0 commit comments

Comments
 (0)