Automatically hyperlink links in WYSIWYG editors
This commit is contained in:
parent
a9dd16cc64
commit
042494128a
@ -78,6 +78,6 @@
|
||||
<div
|
||||
class="editable-base"
|
||||
*ngIf="!isFocused"
|
||||
[innerHTML]="initialValue"
|
||||
[innerHTML]="displayContents"
|
||||
></div>
|
||||
</div>
|
@ -19,6 +19,10 @@ export class NormComponent extends EditorNodeContract implements OnInit {
|
||||
private dirtyOverride = 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(
|
||||
public editorService: EditorService,
|
||||
) {
|
||||
|
Loading…
Reference in New Issue
Block a user