Skip to content

Commit

Permalink
Remove textcomplete.css from sent emails. Fixes adam-p#112.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfx2006 committed Dec 1, 2024
1 parent 2fef04c commit 4b96a12
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 2 additions & 0 deletions extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
[#107](https://gitlab.com/jfx2006/markdown-here-revival/-/issues/107)
- Debounce live preview rendering and enable async rendering.
[#102](https://gitlab.com/jfx2006/markdown-here-revival/-/issues/102)
- textcomplete.css was included in sent messages.
[#112](https://gitlab.com/jfx2006/markdown-here-revival/-/issues/112)

## [4.0.2]

Expand Down
13 changes: 9 additions & 4 deletions extension/auto-emoji.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import Fuse from "./vendor/fuse.basic.mjs"

let _fuse = null

const STYLE_ID = "MDHR_textcomplete"

const loadEmoji = async () => {
if (_fuse == null) {
const url = messenger.runtime.getURL("./data/emoji_codes.json")
Expand Down Expand Up @@ -57,10 +59,13 @@ const EMOJI_STRATEGY = {
}

export function init() {
const linkElem = document.createElement("link")
linkElem.rel = "stylesheet"
linkElem.href = messenger.runtime.getURL("./vendor/textcomplete.css")
document.head.append(linkElem)
if (!document.getElementById(STYLE_ID)) {
const linkElem = document.createElement("link")
linkElem.id = STYLE_ID
linkElem.rel = "stylesheet"
linkElem.href = messenger.runtime.getURL("./vendor/textcomplete.css")
document.head.append(linkElem)
}

const editor = new ContenteditableEditor(document.body)
const textcomplete = new Textcomplete(editor, [EMOJI_STRATEGY])
Expand Down
7 changes: 6 additions & 1 deletion extension/compose_preview/compose_preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import OptionsStore from "../options/options-storage.js"
import { CSSInliner } from "./css-inliner.js"

const STYLE_ELEM_IDS = ["MDHR_syntax_css", "MDHR_main_css"]
const REMOVE_ELEM_IDS = STYLE_ELEM_IDS.concat(["MDHR_CSP", "MDHR_tb_style", "MDHR_preview_style"])
const REMOVE_ELEM_IDS = STYLE_ELEM_IDS.concat([
"MDHR_CSP",
"MDHR_tb_style",
"MDHR_preview_style",
"MDHR_textcomplete",
])

let cssInliner

Expand Down

0 comments on commit 4b96a12

Please sign in to comment.