Automatically hyperlink links in WYSIWYG editors
This commit is contained in:
parent
a9dd16cc64
commit
042494128a
@ -78,6 +78,6 @@
|
|||||||
<div
|
<div
|
||||||
class="editable-base"
|
class="editable-base"
|
||||||
*ngIf="!isFocused"
|
*ngIf="!isFocused"
|
||||||
[innerHTML]="initialValue"
|
[innerHTML]="displayContents"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
@ -19,6 +19,10 @@ export class NormComponent extends EditorNodeContract implements OnInit {
|
|||||||
private dirtyOverride = false;
|
private dirtyOverride = false;
|
||||||
protected hadOneFocusOut = false;
|
protected hadOneFocusOut = false;
|
||||||
|
|
||||||
|
public get displayContents() {
|
||||||
|
return this.contents.replace(/</g, '\n<').replace(/(https?:\/\/[^\s]+)/g, (val) => `<a href="${val}" target="_blank">${val}</a>`);
|
||||||
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public editorService: EditorService,
|
public editorService: EditorService,
|
||||||
) {
|
) {
|
||||||
|
Loading…
Reference in New Issue
Block a user