Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Changelog

## v1.12.2

[compare changes](https://github.com/NativeMindBrowser/NativeMindExtension/compare/v1.12.1...v1.12.2)

### 🚀 Enhancements

- Add Inter and InterDisplay font families with various styles and weights; update font paths in CSS and config; enhance font face URL handling in stylesheets ([5cec648](https://github.com/NativeMindBrowser/NativeMindExtension/commit/5cec648))

### 💅 Refactors

- Streamline font face URL handling in stylesheets by consolidating extraction and replacement logic ([d9ab298](https://github.com/NativeMindBrowser/NativeMindExtension/commit/d9ab298))

### ❤️ Contributors

- Tony Hu ([@tonyhu-012](http://github.com/tonyhu-012))

## v1.12.1

[compare changes](https://github.com/NativeMindBrowser/NativeMindExtension/compare/v1.12.1-beta.0...v1.12.1)

## v1.12.1-beta.0

[compare changes](https://github.com/NativeMindBrowser/NativeMindExtension/compare/v1.12.0...v1.12.1-beta.0)

### 🩹 Fixes

- Add more language entries to SUPPORTED_LANGUAGES for translation ([5d1a911](https://github.com/NativeMindBrowser/NativeMindExtension/commit/5d1a911))

### ❤️ Contributors

- Neko Liu <neko@xmind.org>

## v1.12.0

[compare changes](https://github.com/NativeMindBrowser/NativeMindExtension/compare/v1.12.0-beta.4...v1.12.0)
Expand Down
31 changes: 27 additions & 4 deletions entrypoints/content/ui.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,47 @@
import { createPinia } from 'pinia'
import type { Component } from 'vue'
import { createApp } from 'vue'
import { browser, PublicPath } from 'wxt/browser'
import { ContentScriptContext } from 'wxt/utils/content-script-context'
import { createShadowRootUi } from 'wxt/utils/content-script-ui/shadow-root'

import { initToast } from '@/composables/useToast'
import { CONTENT_UI_SHADOW_ROOT_NAME } from '@/utils/constants'
import { extractFontFace, injectStyleSheetToDocument, loadContentScriptStyleSheet } from '@/utils/css'
import {
extractFontFace,
injectStyleSheetToDocument,
loadContentScriptStyleSheet,
replaceFontFaceUrl,
} from '@/utils/css'
import { createI18nInstance } from '@/utils/i18n/index'
import logger from '@/utils/logger'

async function loadStyleSheet(shadowRoot: ShadowRoot) {
const styleSheet = await loadContentScriptStyleSheet(import.meta.env.ENTRYPOINT)
const styleSheet = await loadContentScriptStyleSheet(
import.meta.env.ENTRYPOINT,
)
injectStyleSheetToDocument(shadowRoot, styleSheet)
// font-face can only be applied to the document, not the shadow root
const fontFaceStyleSheet = extractFontFace(styleSheet)
const fontFaceStyleSheet = replaceFontFaceUrl(extractFontFace(styleSheet), (url) => {
if (
url.startsWith('data:')
|| url.startsWith('moz-extension://')
|| url.startsWith('chrome-extension://')
|| url.startsWith('http://')
|| url.startsWith('https://')
|| url.startsWith('blob:')
) {
return url
}
return browser.runtime.getURL(url as PublicPath)
})
injectStyleSheetToDocument(document, fontFaceStyleSheet)
}

export async function createShadowRootOverlay(ctx: ContentScriptContext, component: Component<{ rootElement: HTMLDivElement }>) {
export async function createShadowRootOverlay(
ctx: ContentScriptContext,
component: Component<{ rootElement: HTMLDivElement }>,
) {
const existingUI = document.querySelector(CONTENT_UI_SHADOW_ROOT_NAME)
if (existingUI) {
try {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nativemind-extension",
"version": "1.12.0",
"version": "1.12.2",
"private": false,
"author": "NativeMind",
"keywords": [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading