mirror of
https://github.com/Elvanos/fantasia-archive.git
synced 2024-09-28 07:11:31 +12:00
Add document: link support to free text
This commit is contained in:
parent
cf7bcbf601
commit
5aca0ca0ed
2 changed files with 14 additions and 13 deletions
26
src/App.vue
26
src/App.vue
|
@ -287,23 +287,23 @@ export default class App extends BaseClass {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||||
if (event.target && event.target.tagName.toLowerCase() === "a" && event.target.closest(".fieldWysiwyg")) {
|
if (event.target && event.target.tagName.toLowerCase() === "a" && event.target.closest(".fieldWysiwyg")) {
|
||||||
const isValidHttpUrl = (string:string) => {
|
try {
|
||||||
let url
|
// @ts-ignore
|
||||||
|
const url = new URL(event.target.href as string)
|
||||||
try {
|
// @ts-ignore
|
||||||
url = new URL(string)
|
console.log(url)
|
||||||
|
if (url.protocol === "http:" || url.protocol === "https:") {
|
||||||
|
shell.openExternal(url.href).catch(e => console.log(e))
|
||||||
}
|
}
|
||||||
catch (_) {
|
else if (url.protocol === "document:") {
|
||||||
return false
|
const doc = this.SGET_document(url.pathname)
|
||||||
|
/* eslint-disable */
|
||||||
|
this.openExistingDocumentRoute(doc)
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
||||||
return url.protocol === "http:" || url.protocol === "https:"
|
|
||||||
}
|
}
|
||||||
|
catch (_) {
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
if (isValidHttpUrl(event.target.href)) {
|
|
||||||
// @ts-ignore
|
|
||||||
shell.openExternal(event.target.href).catch(e => console.log(e))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,6 +170,7 @@ export default class Field_Wysiwyg extends FieldBase {
|
||||||
* Wysiwyg toolbar ontions
|
* Wysiwyg toolbar ontions
|
||||||
*/
|
*/
|
||||||
wysiwygOptions = [
|
wysiwygOptions = [
|
||||||
|
["link"],
|
||||||
["left", "center", "right", "justify"],
|
["left", "center", "right", "justify"],
|
||||||
["bold", "italic", "underline", "subscript", "superscript"],
|
["bold", "italic", "underline", "subscript", "superscript"],
|
||||||
[
|
[
|
||||||
|
|
Loading…
Reference in a new issue