Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

chore(frontend): remove unused LinkifyPipe and OnlyOfficeComponent

johavenda664b9d183a
diff --git a/frontend/src/app/common/components/only-office.component.ts b/frontend/src/app/common/components/only-office.component.ts
deleted file mode 100755
index 69b614b0..00000000
--- a/frontend/src/app/common/components/only-office.component.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core'
-
-declare const DocsAPI: any
-
-@Component({
- selector: 'app-only-office',
- changeDetection: ChangeDetectionStrategy.OnPush,
- template: ` <div id="onlyofficeEditor"></div> `
-})
-export class OnlyOfficeComponent implements OnChanges {
- @Input() config: { script: string; editorConfig: any }
- protected editor: any
-
- ngOnChanges() {
- if (this.editor) {
- this.editor.destroyEditor()
- }
- this.createEditor()
- }
-
- loadScript(src: any) {
- return new Promise((resolve) => {
- const script: any = document.createElement('script')
- script.type = 'text/javascript'
- script.src = src
- if (script.readyState) {
- script.onreadystatechange = () => {
- if (script.readyState === 'loaded' || script.readyState === 'complete') {
- script.onreadystatechange = null
- resolve({ script: name, loaded: true, status: 'Loaded' })
- }
- }
- } else {
- script.onload = () => {
- resolve({ script: name, loaded: true, status: 'Loaded' })
- }
- }
- script.onerror = () => resolve({ script: name, loaded: false, status: 'Loaded' })
- document.getElementsByTagName('head')[0].appendChild(script)
- })
- }
-
- private createEditor() {
- if (typeof DocsAPI !== 'undefined') {
- this.editor = new DocsAPI.DocEditor('onlyofficeEditor', this.config.editorConfig)
- } else {
- this.loadScript(this.config.script)
- .then(() => {
- this.createEditor()
- })
- .catch(console.error)
- }
- }
-}
diff --git a/frontend/src/app/common/pipes/linkify.pipe.ts b/frontend/src/app/common/pipes/linkify.pipe.ts
deleted file mode 100644
index 75462b28..00000000
--- a/frontend/src/app/common/pipes/linkify.pipe.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { inject, Pipe, PipeTransform, SecurityContext } from '@angular/core'
-import { DomSanitizer } from '@angular/platform-browser'
-
-@Pipe({ name: 'linkify' })
-export class LinkifyPipe implements PipeTransform {
- private readonly sanitizer = inject(DomSanitizer)
-
- transform(value: any): any {
- return this.sanitizer.sanitize(SecurityContext.HTML, this.stylize(value))
- }
-
- // Modify this method according to your custom logic
- private stylize(text: string): string {
- let stylizedText = ''
- if (text?.length && text.indexOf('http') > -1) {
- for (const t of text.split(' ')) {
- if (t.startsWith('http') && t.length > 7) {
- stylizedText += `<a href="${t}" target="${t.startsWith(document.location.origin) ? '_self' : '_blank'}">${t}</a> `
- } else stylizedText += `${t} `
- }
- return stylizedText
- } else {
- return text
- }
- }
-}