Fix multiline comment

This commit is contained in:
barsdeveloper
2023-04-09 23:46:26 +02:00
parent c58c8be0a0
commit 41165fe20e
10 changed files with 29 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
import Configuration from "./Configuration.js"
import ComputedType from "./entity/ComputedType.js"
import Configuration from "./Configuration.js"
import UnionType from "./entity/UnionType.js"
/**
@@ -316,10 +316,15 @@ export default class Utility {
static clearHTMLWhitespace(value) {
return value
.replaceAll(" ", "\u00A0") // whitespace
.replaceAll("<br>", "\n") // newlines
.replaceAll(/<br\s*\/>|<br>/, "\n") // newlines
.replaceAll(/(\<!--.*?\-->)/g, "") // html comments
}
/** @param {String} value */
static encodeHTMLWhitespace(value) {
return value.replaceAll(" ", "\u00A0")
}
/** @param {String} value */
static capitalFirstLetter(value) {
if (value.length === 0) {

View File

@@ -179,7 +179,7 @@ export default class PinEntity extends IEntity {
&& (match = this.PinToolTip.match(/\s*(.+?(?=\n)|.+\S)\s*/))
) {
if (match[1].toLowerCase() === result.toLowerCase()) {
return match[1]
return match[1] // In case they match, then keep the case of the PinToolTip
}
}
return result

View File

@@ -2,6 +2,7 @@ import { css, html } from "lit"
import Configuration from "../../Configuration.js"
import IResizeableTemplate from "../IResizeableTemplate.js"
import LinearColorEntity from "../../entity/LinearColorEntity.js"
import Utility from "../../Utility.js"
/**
* @typedef {import("../../element/NodeElement").default} NodeElement
@@ -42,8 +43,8 @@ export default class CommentNodeTemplate extends IResizeableTemplate {
return html`
<div class="ueb-node-border">
<div class="ueb-node-wrapper">
<div class="ueb-node-top">
${this.element.entity.NodeComment}
<div class="ueb-node-top"
.innerText="${Utility.encodeHTMLWhitespace(this.element.entity.NodeComment)}">
</div>
</div>
</div>