1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-05 00:22:33 +03:00

Merge branch 'development' into release

This commit is contained in:
Dan Brown
2022-02-27 17:45:49 +00:00
7 changed files with 40 additions and 16 deletions

View File

@ -35,6 +35,15 @@ body:
description: Provide any additional context and screenshots here to help us solve this issue description: Provide any additional context and screenshots here to help us solve this issue
validations: validations:
required: false required: false
- type: input
id: browserdetails
attributes:
label: Browser Details
description: |
If this is an issue that occurs when using the BookStack interface, please provide details of the browser used which presents the reported issue.
placeholder: (eg. Firefox 97 (64-bit) on Windows 11)
validations:
required: false
- type: input - type: input
id: bsversion id: bsversion
attributes: attributes:

View File

@ -33,8 +33,7 @@ body:
attributes: attributes:
label: Have you searched for an existing open/closed issue? label: Have you searched for an existing open/closed issue?
description: | description: |
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) 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.
for any existing issues that cover the fundemental benefit/goal of your request.
options: options:
- label: I have searched for existing issues and none cover my fundemental request - label: I have searched for existing issues and none cover my fundemental request
required: true required: true

View File

@ -63,7 +63,7 @@ Below is a high-level road map view for BookStack to provide a sense of directio
- **Platform REST API** - *(Most actions implemented, maturing)* - **Platform REST API** - *(Most actions implemented, maturing)*
- *A REST API covering, at minimum, control of core content models (Books, Chapters, Pages) for automation and platform extension.* - *A REST API covering, at minimum, control of core content models (Books, Chapters, Pages) for automation and platform extension.*
- **Editor Alignment & Review** - *(Started)* - **Editor Alignment & Review** - *(In Progress)*
- *Review the page editors with goal of achieving increased interoperability & feature parity while also considering collaborative editing potential.* - *Review the page editors with goal of achieving increased interoperability & feature parity while also considering collaborative editing potential.*
- **Permission System Review** - **Permission System Review**
- *Improvement in how permissions are applied and a review of the efficiency of the permission & roles system.* - *Improvement in how permissions are applied and a review of the efficiency of the permission & roles system.*

View File

@ -59,12 +59,10 @@ class CodeEditor {
this.languageInput.value = language; this.languageInput.value = language;
this.callback = callback; this.callback = callback;
this.show(); this.show()
this.updateEditorMode(language); .then(() => this.updateEditorMode(language))
.then(() => window.importVersioned('code'))
window.importVersioned('code').then(Code => { .then(Code => Code.setContent(this.editor, code));
Code.setContent(this.editor, code);
});
} }
async show() { async show() {

View File

@ -91,15 +91,35 @@ function defineCodeBlockCustomElement(editor) {
} }
connectedCallback() { connectedCallback() {
const connectedTime = Date.now();
if (this.cm) { if (this.cm) {
return; return;
} }
this.cleanChildContent();
const container = this.shadowRoot.querySelector('.CodeMirrorContainer'); const container = this.shadowRoot.querySelector('.CodeMirrorContainer');
importVersioned('code').then(Code => { const renderCodeMirror = (Code) => {
this.cm = Code.wysiwygView(container, this.getContent(), this.getLanguage()); this.cm = Code.wysiwygView(container, this.getContent(), this.getLanguage());
Code.updateLayout(this.cm);
};
window.importVersioned('code').then((Code) => {
const timeout = (Date.now() - connectedTime < 20) ? 20 : 0;
setTimeout(() => renderCodeMirror(Code), timeout);
}); });
} }
cleanChildContent() {
const pre = this.querySelector('pre');
if (!pre) return;
for (const preChild of pre.childNodes) {
if (preChild.nodeName === '#text' && preChild.textContent === '') {
preChild.remove();
}
}
}
} }
win.customElements.define('code-block', CodeBlockElement); win.customElements.define('code-block', CodeBlockElement);
@ -130,15 +150,13 @@ function register(editor, url) {
} else { } else {
const textContent = editor.selection.getContent({format: 'text'}); const textContent = editor.selection.getContent({format: 'text'});
showPopup(editor, textContent, '', (newCode, newLang) => { showPopup(editor, textContent, '', (newCode, newLang) => {
const wrap = doc.createElement('code-block');
const pre = doc.createElement('pre'); const pre = doc.createElement('pre');
const code = doc.createElement('code'); const code = doc.createElement('code');
code.classList.add(`language-${newLang}`); code.classList.add(`language-${newLang}`);
code.innerText = newCode; code.innerText = newCode;
pre.append(code); pre.append(code);
wrap.append(pre);
editor.insertContent(wrap.outerHTML); editor.insertContent(pre.outerHTML);
}); });
} }
}); });
@ -168,7 +186,7 @@ function register(editor, url) {
editor.parser.addNodeFilter('code-block', function(elms) { editor.parser.addNodeFilter('code-block', function(elms) {
for (const el of elms) { for (const el of elms) {
el.attr('content-editable', 'false'); el.attr('contenteditable', 'false');
} }
}); });

View File

@ -57,7 +57,7 @@ return [
'list_numbered' => '有序列表', 'list_numbered' => '有序列表',
'indent_increase' => '增加缩进', 'indent_increase' => '增加缩进',
'indent_decrease' => '减少缩进', 'indent_decrease' => '减少缩进',
'table' => '表', 'table' => '表',
'insert_image' => '插入图片', 'insert_image' => '插入图片',
'insert_image_title' => '插入/编辑图片', 'insert_image_title' => '插入/编辑图片',
'insert_link' => '插入/编辑链接', 'insert_link' => '插入/编辑链接',

View File

@ -1,7 +1,7 @@
@extends('layouts.base') @extends('layouts.base')
@section('head') @section('head')
<script src="{{ url('/libs/tinymce/tinymce.min.js?ver=4.9.4') }}" nonce="{{ $cspNonce }}"></script> <script src="{{ url('/libs/tinymce/tinymce.min.js?ver=5.10.2') }}" nonce="{{ $cspNonce }}"></script>
@stop @stop
@section('body-class', 'flexbox') @section('body-class', 'flexbox')