forked from mystiq/hydrogen-web
Rename TextTileFormat to BodyFormat
This commit is contained in:
parent
031ce42831
commit
7cfdd4f663
2 changed files with 8 additions and 8 deletions
|
@ -18,7 +18,7 @@ import {BaseMessageTile} from "./BaseMessageTile.js";
|
|||
import {stringAsBody} from "../MessageBody.js";
|
||||
import {createEnum} from "../../../../../utils/enum.js";
|
||||
|
||||
export const TextTileFormat = createEnum("Plain", "Html");
|
||||
export const BodyFormat = createEnum("Plain", "Html");
|
||||
|
||||
export class BaseTextTile extends BaseMessageTile {
|
||||
constructor(options) {
|
||||
|
@ -36,7 +36,7 @@ export class BaseTextTile extends BaseMessageTile {
|
|||
}
|
||||
|
||||
_getBodyFormat() {
|
||||
return TextTileFormat.Plain;
|
||||
return BodyFormat.Plain;
|
||||
}
|
||||
|
||||
get body() {
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {BaseTextTile, TextTileFormat} from "./BaseTextTile.js";
|
||||
import {BaseTextTile, BodyFormat} from "./BaseTextTile.js";
|
||||
import {parsePlainBody} from "../MessageBody.js";
|
||||
import {parseHTMLBody} from "../deserialize.js";
|
||||
|
||||
|
@ -37,7 +37,7 @@ export class TextTile extends BaseTextTile {
|
|||
}
|
||||
|
||||
_getBody() {
|
||||
if (this._getBodyFormat() == TextTileFormat.Html) {
|
||||
if (this._getBodyFormat() == BodyFormat.Html) {
|
||||
return this._getFormattedBody();
|
||||
} else {
|
||||
return this._getPlainBody();
|
||||
|
@ -45,15 +45,15 @@ export class TextTile extends BaseTextTile {
|
|||
}
|
||||
|
||||
_getBodyFormat() {
|
||||
if (this._getContent()?.["format"] === "org.matrix.custom.html") {
|
||||
return TextTileFormat.Html;
|
||||
if (this._getContent()?.format === "org.matrix.custom.html") {
|
||||
return BodyFormat.Html;
|
||||
} else {
|
||||
return TextTileFormat.Plain;
|
||||
return BodyFormat.Plain;
|
||||
}
|
||||
}
|
||||
|
||||
_parseBody(body, format) {
|
||||
if (format === TextTileFormat.Html) {
|
||||
if (format === BodyFormat.Html) {
|
||||
return parseHTMLBody(this.platform, this._mediaRepository, body);
|
||||
} else {
|
||||
return parsePlainBody(body);
|
||||
|
|
Loading…
Reference in a new issue