-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
63 changed files
with
2,400 additions
and
583 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,11 @@ coverage | |
*.sln | ||
*.sw? | ||
.eslintcache | ||
|
||
# Nuxt | ||
.nuxt | ||
.output | ||
.vercel_build_output | ||
.build-* | ||
.env | ||
.netlify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "mt-v-safe-html", | ||
"version": "0.0.0", | ||
"description": "", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "run-p type-check build-only", | ||
"build-only": "vite build", | ||
"build:watch": "pnpm run build-only --watch", | ||
"type-check": "vue-tsc --noEmit -p ../../tsconfig.vitest.json --composite false" | ||
}, | ||
"type": "module", | ||
"files": [ | ||
"dist" | ||
], | ||
"sideEffects": false, | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"require": "./dist/index.umd.cjs", | ||
"import": "./dist/index.js" | ||
}, | ||
"./*": "./dist/*" | ||
}, | ||
"main": "./dist/index.umd.cjs", | ||
"module": "./dist/index.js", | ||
"types": "./dist/index.d.ts" | ||
} |
This file was deleted.
Oops, something went wrong.
5 changes: 2 additions & 3 deletions
5
packages/core/__tests__/plugins.spec.ts → ...es/core/plugins/__tests__/plugins.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import type { App } from 'vue' | ||
import { useI18n } from 'vue-i18n' | ||
import DOMPurify from 'dompurify' | ||
import { setGlobalOptions, getBindingValue } from '../shared' | ||
import type { Options } from '../shared' | ||
import { generateHtml } from './generateHtml' | ||
|
||
const $i18nHtml = generateHtml((binding) => { | ||
if (!useI18n) { | ||
console.warn(`[mt-v-safe-html]: can not find vue-i18n`) | ||
return '' | ||
} | ||
const { t } = useI18n() | ||
const i18nContentKey = getBindingValue(binding) | ||
return getBindingValue(() => t(i18nContentKey)) | ||
}, DOMPurify.sanitize) | ||
|
||
export const createI18nHtml = { | ||
install: (app: App, options?: Options) => { | ||
if (options) { | ||
setGlobalOptions(options) | ||
} | ||
|
||
app.config.globalProperties.$i18nHtml = $i18nHtml | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { App } from 'vue' | ||
import DOMPurify from 'dompurify' | ||
import { setGlobalOptions, getBindingValue } from '../shared' | ||
import type { Options } from '../shared' | ||
import { generateHtml } from './generateHtml' | ||
|
||
const $safeHtml = generateHtml(getBindingValue, DOMPurify.sanitize) | ||
export const createSafeHtml = { | ||
install: (app: App, options?: Options) => { | ||
if (options) { | ||
setGlobalOptions(options) | ||
} | ||
|
||
app.config.globalProperties.$safeHtml = $safeHtml | ||
} | ||
} |
Oops, something went wrong.