Skip to content

Commit ac202c8

Browse files
andreaskienastsbuerk
authored andcommitted
[!!!][TASK] Merge EXT:t3editor into backend
This patch merges the "t3editor" extension into EXT:backend. The overall benefit is a globally available syntax highlighting at various places, without the need to have an extra extension installed. Another benefit it the removal of installation checks of EXT:t3editor and fallbacks if the "soft requirement" is not fulfilled, reducing soft-cross-dependencies. Resolves: #102440 Releases: main Change-Id: I76301c9cff08f61a5721fa34f4e3e950687b67b0 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81799 Reviewed-by: Stefan Bürk <[email protected]> Tested-by: Christian Kuhn <[email protected]> Tested-by: core-ci <[email protected]> Reviewed-by: Christian Kuhn <[email protected]> Tested-by: Stefan Bürk <[email protected]>
1 parent ad5fb39 commit ac202c8

File tree

147 files changed

+600
-1437
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+600
-1437
lines changed

.gitattributes

-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,3 @@
3333
*.t3s text eol=lf
3434
*.txt text eol=lf
3535
/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/codesnippet/lib/highlight/LICENSE text eol=lf
36-
/typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/AUTHORS text eol=lf
37-
/typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/LICENSE text eol=lf
38-
/typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/bin/source-highlight text eol=lf

Build/Gruntfile.js

+35-27
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ module.exports = function (grunt) {
118118
linkvalidator: '<%= paths.sysext %>linkvalidator/Resources/',
119119
backend: '<%= paths.sysext %>backend/Resources/',
120120
styleguide: '<%= paths.sysext %>styleguide/Resources/',
121-
t3editor: '<%= paths.sysext %>t3editor/Resources/',
122121
workspaces: '<%= paths.sysext %>workspaces/Resources/',
123122
ckeditor: '<%= paths.sysext %>rte_ckeditor/Resources/',
124123
core: '<%= paths.sysext %>core/Resources/',
@@ -268,9 +267,6 @@ module.exports = function (grunt) {
268267
styleguide: {
269268
src: '<%= paths.styleguide %>Public/Css/*.css'
270269
},
271-
t3editor: {
272-
src: '<%= paths.t3editor %>Public/Css/**/*.css'
273-
},
274270
workspaces: {
275271
src: '<%= paths.workspaces %>Public/Css/*.css'
276272
}
@@ -443,36 +439,36 @@ module.exports = function (grunt) {
443439
{
444440
expand: true,
445441
cwd: '<%= paths.node_modules %>@codemirror',
446-
dest: '<%= paths.t3editor %>Public/JavaScript/Contrib/@codemirror/',
442+
dest: '<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/',
447443
rename: (dest, src) => dest + src.replace('/dist/index', ''),
448444
src: ['*/dist/index.js']
449445
},
450446
{
451447
expand: true,
452448
cwd: '<%= paths.node_modules %>@lezer',
453-
dest: '<%= paths.t3editor %>Public/JavaScript/Contrib/@lezer/',
449+
dest: '<%= paths.backend %>Public/JavaScript/Contrib/@lezer/',
454450
rename: (dest, src) => dest + src.replace('/dist/index.es', ''),
455451
src: ['*/dist/index.es.js']
456452
},
457453
{
458454
src: '<%= paths.node_modules %>@lezer/lr/dist/index.js',
459-
dest: '<%= paths.t3editor %>Public/JavaScript/Contrib/@lezer/lr.js'
455+
dest: '<%= paths.backend %>Public/JavaScript/Contrib/@lezer/lr.js'
460456
},
461457
{
462458
src: '<%= paths.node_modules %>@lezer/common/dist/index.js',
463-
dest: '<%= paths.t3editor %>Public/JavaScript/Contrib/@lezer/common.js'
459+
dest: '<%= paths.backend %>Public/JavaScript/Contrib/@lezer/common.js'
464460
},
465461
{
466462
src: '<%= paths.node_modules %>crelt/index.es.js',
467-
dest: '<%= paths.t3editor %>Public/JavaScript/Contrib/crelt.js'
463+
dest: '<%= paths.backend %>Public/JavaScript/Contrib/crelt.js'
468464
},
469465
{
470466
src: '<%= paths.node_modules %>style-mod/src/style-mod.js',
471-
dest: '<%= paths.t3editor %>Public/JavaScript/Contrib/style-mod.js'
467+
dest: '<%= paths.backend %>Public/JavaScript/Contrib/style-mod.js'
472468
},
473469
{
474470
src: '<%= paths.node_modules %>w3c-keyname/index.es.js',
475-
dest: '<%= paths.t3editor %>Public/JavaScript/Contrib/w3c-keyname.js'
471+
dest: '<%= paths.backend %>Public/JavaScript/Contrib/w3c-keyname.js'
476472
},
477473
]
478474
}
@@ -769,6 +765,33 @@ module.exports = function (grunt) {
769765
},
770766
thirdparty: {
771767
files: {
768+
'<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/autocomplete.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/autocomplete.js'],
769+
'<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/commands.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/commands.js'],
770+
'<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/lang-css.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/lang-css.js'],
771+
'<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/lang-html.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/lang-html.js'],
772+
'<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/lang-javascript.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/lang-javascript.js'],
773+
'<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/lang-json.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/lang-json.js'],
774+
'<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/lang-php.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/lang-php.js'],
775+
'<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/lang-sql.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/lang-sql.js'],
776+
'<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/language.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/language.js'],
777+
'<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/lang-xml.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/lang-xml.js'],
778+
'<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/lint.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/lint.js'],
779+
'<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/search.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/search.js'],
780+
'<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/state.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/state.js'],
781+
'<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/theme-one-dark.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/theme-one-dark.js'],
782+
'<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/view.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@codemirror/view.js'],
783+
'<%= paths.backend %>Public/JavaScript/Contrib/@lezer/common.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@lezer/common.js'],
784+
'<%= paths.backend %>Public/JavaScript/Contrib/@lezer/css.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@lezer/css.js'],
785+
'<%= paths.backend %>Public/JavaScript/Contrib/@lezer/highlight.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@lezer/highlight.js'],
786+
'<%= paths.backend %>Public/JavaScript/Contrib/@lezer/html.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@lezer/html.js'],
787+
'<%= paths.backend %>Public/JavaScript/Contrib/@lezer/javascript.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@lezer/javascript.js'],
788+
'<%= paths.backend %>Public/JavaScript/Contrib/@lezer/json.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@lezer/json.js'],
789+
'<%= paths.backend %>Public/JavaScript/Contrib/@lezer/lr.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@lezer/lr.js'],
790+
'<%= paths.backend %>Public/JavaScript/Contrib/@lezer/php.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@lezer/php.js'],
791+
'<%= paths.backend %>Public/JavaScript/Contrib/@lezer/xml.js': ['<%= paths.backend %>Public/JavaScript/Contrib/@lezer/xml.js'],
792+
'<%= paths.backend %>Public/JavaScript/Contrib/crelt.js': ['<%= paths.backend %>Public/JavaScript/Contrib/crelt.js'],
793+
'<%= paths.backend %>Public/JavaScript/Contrib/style-mod.js': ['<%= paths.backend %>Public/JavaScript/Contrib/style-mod.js'],
794+
'<%= paths.backend %>Public/JavaScript/Contrib/w3c-keyname.js': ['<%= paths.backend %>Public/JavaScript/Contrib/w3c-keyname.js'],
772795
'<%= paths.core %>Public/JavaScript/Contrib/cropperjs.js': ['<%= paths.core %>Public/JavaScript/Contrib/cropperjs.js'],
773796
'<%= paths.core %>Public/JavaScript/Contrib/flatpickr/flatpickr.min.js': ['<%= paths.core %>Public/JavaScript/Contrib/flatpickr/flatpickr.min.js'],
774797
'<%= paths.core %>Public/JavaScript/Contrib/flatpickr/locales.js': ['<%= paths.core %>Public/JavaScript/Contrib/flatpickr/locales.js'],
@@ -778,21 +801,6 @@ module.exports = function (grunt) {
778801
'<%= paths.core %>Public/JavaScript/Contrib/taboverride.js': ['<%= paths.core %>Public/JavaScript/Contrib/taboverride.js']
779802
}
780803
},
781-
t3editor: {
782-
files: [
783-
{
784-
expand: true,
785-
src: [
786-
'<%= paths.t3editor %>Public/JavaScript/Contrib/**/*.js'
787-
],
788-
dest: '<%= paths.t3editor %>Public/JavaScript/Contrib',
789-
cwd: '.',
790-
rename: function (dest, src) {
791-
return src;
792-
}
793-
}
794-
]
795-
},
796804
typescript: {
797805
options: {
798806
output: {
@@ -830,7 +838,7 @@ module.exports = function (grunt) {
830838
lint: ['eslint', 'stylelint', 'exec:lintspaces'],
831839
compile_assets: ['scripts', 'css'],
832840
compile_flags: ['flags-build'],
833-
minify_assets: ['terser:thirdparty', 'terser:t3editor'],
841+
minify_assets: ['terser:thirdparty'],
834842
copy_static: ['copy:core_icons', 'copy:install_icons', 'copy:module_icons', 'copy:extension_icons', 'copy:fonts', 'copy-lit', 'copy:t3editor'],
835843
build: ['copy:core_icons', 'copy:install_icons', 'copy:module_icons', 'copy:extension_icons', 'copy:fonts', 'copy:t3editor'],
836844
},

Build/Sources/TypeScript/t3editor/autocomplete/completion-result.ts Build/Sources/TypeScript/backend/code-editor/autocomplete/completion-result.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
* The TYPO3 project - inspiring people to share!
1212
*/
1313

14-
import type { TsRef, TsRefType } from '@typo3/t3editor/autocomplete/ts-ref';
15-
import type { TreeNode } from '@typo3/t3editor/autocomplete/ts-parser';
14+
import type { TsRef, TsRefType } from './ts-ref';
15+
import type { TreeNode } from './ts-parser';
1616

1717
export type Proposal = {
1818
type: string,

Build/Sources/TypeScript/t3editor/autocomplete/ts-code-completion.ts Build/Sources/TypeScript/backend/code-editor/autocomplete/ts-code-completion.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
*/
1313

1414
/**
15-
* Module: @typo3/t3editor/autocomplete/ts-code-completion
15+
* Module: ./ts-code-completion
1616
* Contains the TsCodeCompletion class
1717
*/
1818
import AjaxRequest from '@typo3/core/ajax/ajax-request';
19-
import { TsRef } from '@typo3/t3editor/autocomplete/ts-ref';
20-
import { TsParser } from '@typo3/t3editor/autocomplete/ts-parser';
21-
import { CompletionResult, Proposal } from '@typo3/t3editor/autocomplete/completion-result';
19+
import { TsRef } from './ts-ref';
20+
import { TsParser } from './ts-parser';
21+
import { CompletionResult, Proposal } from './completion-result';
2222

23-
import type { CodeMirror5CompatibleCompletionState } from '@typo3/t3editor/language/typoscript';
23+
import type { CodeMirror5CompatibleCompletionState } from '../language/typoscript';
2424

2525
export type ContentObjectIdentifier = string;
2626

@@ -77,7 +77,7 @@ export class TsCodeCompletion {
7777
if (Number.isNaN(id) || id === 0) {
7878
return null;
7979
}
80-
new AjaxRequest(TYPO3.settings.ajaxUrls.t3editor_codecompletion_loadtemplates)
80+
new AjaxRequest(TYPO3.settings.ajaxUrls.codeeditor_codecompletion_loadtemplates)
8181
.withQueryArguments({ pageId: id })
8282
.get()
8383
.then(async (response) => {

Build/Sources/TypeScript/t3editor/autocomplete/ts-parser.ts Build/Sources/TypeScript/backend/code-editor/autocomplete/ts-parser.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
* The TYPO3 project - inspiring people to share!
1212
*/
1313

14-
import type { TsRef } from '@typo3/t3editor/autocomplete/ts-ref';
15-
import type { TsObjTree } from '@typo3/t3editor/autocomplete/ts-code-completion';
16-
import type { CodeMirror5CompatibleCompletionState } from '@typo3/t3editor/language/typoscript';
14+
import type { TsRef } from './ts-ref';
15+
import type { TsObjTree } from './ts-code-completion';
16+
import type { CodeMirror5CompatibleCompletionState } from '../language/typoscript';
1717

1818
export class TreeNode {
1919
public value: string;

Build/Sources/TypeScript/t3editor/autocomplete/ts-ref.ts Build/Sources/TypeScript/backend/code-editor/autocomplete/ts-ref.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class TsRef {
6363
* Load available TypoScript reference
6464
*/
6565
public async loadTsrefAsync(): Promise<void> {
66-
const response = await new AjaxRequest(TYPO3.settings.ajaxUrls.t3editor_tsref).get();
66+
const response = await new AjaxRequest(TYPO3.settings.ajaxUrls.codeeditor_tsref).get();
6767
this.doc = await response.resolve();
6868
this.buildTree();
6969
}

Build/Sources/TypeScript/t3editor/element/code-mirror-element.ts Build/Sources/TypeScript/backend/code-editor/element/code-mirror-element.ts

+23-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { executeJavaScriptModuleInstruction, loadModule, resolveSubjectRef, Java
3131
import '@typo3/backend/element/spinner-element';
3232

3333
/**
34-
* Module: @typo3/t3editor/element/code-mirror-element
34+
* Module: @typo3/backend/code-editor/element/code-mirror-element
3535
* Renders CodeMirror into FormEngine
3636
*/
3737
@customElement('typo3-t3editor-codemirror')
@@ -161,6 +161,28 @@ export class CodeMirrorElement extends LitElement {
161161
observer.observe(this);
162162
}
163163

164+
/**
165+
* @internal
166+
*/
167+
public setContent(newContent: string): void {
168+
if (this.editorView !== null) {
169+
this.editorView.dispatch({
170+
changes: {
171+
from: 0,
172+
to: this.editorView.state.doc.length,
173+
insert: newContent
174+
}
175+
});
176+
}
177+
}
178+
179+
/**
180+
* @internal
181+
*/
182+
public getContent(): string {
183+
return this.editorView.state.doc.toString();
184+
}
185+
164186
private onKeydown(event: KeyboardEvent): void {
165187
if (event.ctrlKey && event.altKey && event.key === 'f') {
166188
event.preventDefault();

Build/Sources/TypeScript/t3editor/language/typoscript.ts Build/Sources/TypeScript/backend/code-editor/language/typoscript.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import DocumentService from '@typo3/core/document-service';
22
import { StreamLanguage, LanguageSupport } from '@codemirror/language';
33
import { CompletionContext, CompletionResult } from '@codemirror/autocomplete';
4-
import { TypoScriptStreamParserFactory } from '@typo3/t3editor/stream-parser/typoscript';
5-
import { TsCodeCompletion } from '@typo3/t3editor/autocomplete/ts-code-completion';
4+
import { TypoScriptStreamParserFactory } from '../stream-parser/typoscript';
5+
import { TsCodeCompletion } from '../autocomplete/ts-code-completion';
66
import { syntaxTree } from '@codemirror/language';
77
import type { SyntaxNodeRef } from '@lezer/common';
88

@@ -23,7 +23,7 @@ export interface CodeMirror5CompatibleCompletionState {
2323
}
2424

2525
/**
26-
* Module: @typo3/t3editor/language/typoscript
26+
* Module: @typo3/backend/code-editor/language/typoscript
2727
*
2828
* Entry Point module for CodeMirror v6 language highlighting and code completion for TypoScript.
2929
* This module combines our CodeMirror v5 style typoscript parser (via the StreamLanguage shim) and

Build/Sources/TypeScript/backend/grid-editor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { html, LitElement, nothing, TemplateResult } from 'lit';
2020
import { classMap } from 'lit/directives/class-map';
2121
import { StyleInfo, styleMap } from 'lit/directives/style-map';
2222
import { ref, Ref, createRef } from 'lit/directives/ref';
23-
import { CodeMirrorElement } from '@typo3/t3editor/element/code-mirror-element';
23+
import { CodeMirrorElement } from '@typo3/backend/code-editor/element/code-mirror-element';
2424

2525
type Cell = { spanned: number, rowspan: number, colspan: number, name: string, colpos: string, column: number }
2626

Build/Sources/TypeScript/backend/pagetsconfig/pagetsconfig-includes.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ class PageTsConfigIncludes {
5252

5353
private async fetchModalContent(url: string): Promise<TemplateResult> {
5454
// no `await` purpose (webcomponents initialize lazily)
55-
topLevelModuleImport('@typo3/t3editor/element/code-mirror-element.js');
55+
topLevelModuleImport('@typo3/backend/code-editor/element/code-mirror-element.js');
5656

5757
const response: AjaxResponse = await (new AjaxRequest(url)).get();
5858
const source: string = await response.resolve();
5959

6060
const mode: JavaScriptItemPayload = {
61-
name: '@typo3/t3editor/language/typoscript.js',
61+
name: '@typo3/backend/code-editor/language/typoscript.js',
6262
flags: 2 /* FLAG_USE_IMPORTMAP */,
6363
exportName: 'typoscript',
6464
items: [

Build/Sources/TypeScript/tstemplate/template-analyzer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ class TemplateAnalyzer {
5252

5353
private async fetchModalContent(url: string): Promise<TemplateResult> {
5454
// no `await` purpose (webcomponents initialize lazily)
55-
topLevelModuleImport('@typo3/t3editor/element/code-mirror-element.js');
55+
topLevelModuleImport('@typo3/backend/code-editor/element/code-mirror-element.js');
5656

5757
const response: AjaxResponse = await (new AjaxRequest(url)).get();
5858
const source: string = await response.resolve();
5959

6060
const mode: JavaScriptItemPayload = {
61-
name: '@typo3/t3editor/language/typoscript.js',
61+
name: '@typo3/backend/code-editor/language/typoscript.js',
6262
flags: 2 /* FLAG_USE_IMPORTMAP */,
6363
exportName: 'typoscript',
6464
items: [

Build/tsconfig.json

-3
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@
8484
"@typo3/styleguide/*": [
8585
"styleguide/*"
8686
],
87-
"@typo3/t3editor/*": [
88-
"t3editor/*"
89-
],
9087
"@typo3/tstemplate/*": [
9188
"tstemplate/*"
9289
],

0 commit comments

Comments
 (0)