@tiptap/extension-text-style
Advanced tools
Comparing version 2.0.0-alpha.4 to 2.0.0-alpha.5
@@ -6,2 +6,10 @@ # Change Log | ||
# [2.0.0-alpha.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-text-style@2.0.0-alpha.4...@tiptap/extension-text-style@2.0.0-alpha.5) (2020-12-18) | ||
**Note:** Version bump only for package @tiptap/extension-text-style | ||
# [2.0.0-alpha.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-text-style@2.0.0-alpha.3...@tiptap/extension-text-style@2.0.0-alpha.4) (2020-12-02) | ||
@@ -8,0 +16,0 @@ |
@@ -1,18 +0,3 @@ | ||
import { Command, Mark } from '@tiptap/core'; | ||
export interface TextStyleOptions { | ||
HTMLAttributes: { | ||
[key: string]: any; | ||
}; | ||
} | ||
declare const TextStyle: Mark<TextStyleOptions, { | ||
/** | ||
* Remove spans without inline style attributes. | ||
*/ | ||
removeEmptyTextStyle: () => Command; | ||
}>; | ||
import { TextStyle } from './text-style'; | ||
export * from './text-style'; | ||
export default TextStyle; | ||
declare module '@tiptap/core' { | ||
interface AllExtensions { | ||
TextStyle: typeof TextStyle; | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@tiptap/core")):"function"==typeof define&&define.amd?define(["@tiptap/core"],e):(t="undefined"!=typeof globalThis?globalThis:t||self)["@tiptap/extension-text-style"]=e(t["@tiptap/core"])}(this,(function(t){"use strict";return t.Mark.create({name:"textStyle",defaultOptions:{HTMLAttributes:{}},parseHTML:()=>[{tag:"span",getAttrs:t=>!!t.hasAttribute("style")&&{}}],renderHTML({HTMLAttributes:e}){return["span",t.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:e,commands:r})=>{const s=t.getMarkAttributes(e,this.type);return!!Object.entries(s).every((([,t])=>!!t))||r.unsetMark("textStyle")}}}})})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tiptap/core")):"function"==typeof define&&define.amd?define(["exports","@tiptap/core"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@tiptap/extension-text-style"]={},t["@tiptap/core"])}(this,(function(t,e){"use strict";const r=e.Mark.create({name:"textStyle",defaultOptions:{HTMLAttributes:{}},parseHTML:()=>[{tag:"span",getAttrs:t=>!!t.hasAttribute("style")&&{}}],renderHTML({HTMLAttributes:t}){return["span",e.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:r})=>{const s=e.getMarkAttributes(t,this.type);return!!Object.entries(s).every((([,t])=>!!t))||r.unsetMark("textStyle")}}}});t.TextStyle=r,t.default=r,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=tiptap-extension-text-style.bundle.umd.min.js.map |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var core = require('@tiptap/core'); | ||
@@ -44,3 +46,4 @@ | ||
module.exports = TextStyle; | ||
exports.TextStyle = TextStyle; | ||
exports.default = TextStyle; | ||
//# sourceMappingURL=tiptap-extension-text-style.cjs.js.map |
@@ -43,2 +43,3 @@ import { Mark, mergeAttributes, getMarkAttributes } from '@tiptap/core'; | ||
export default TextStyle; | ||
export { TextStyle }; | ||
//# sourceMappingURL=tiptap-extension-text-style.esm.js.map |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@tiptap/core')) : | ||
typeof define === 'function' && define.amd ? define(['@tiptap/core'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global['@tiptap/extension-text-style'] = factory(global.core)); | ||
}(this, (function (core) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/core')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@tiptap/core'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['@tiptap/extension-text-style'] = {}, global.core)); | ||
}(this, (function (exports, core) { 'use strict'; | ||
@@ -46,5 +46,8 @@ const TextStyle = core.Mark.create({ | ||
return TextStyle; | ||
exports.TextStyle = TextStyle; | ||
exports.default = TextStyle; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
//# sourceMappingURL=tiptap-extension-text-style.umd.js.map |
{ | ||
"name": "@tiptap/extension-text-style", | ||
"description": "text style extension for tiptap", | ||
"version": "2.0.0-alpha.4", | ||
"version": "2.0.0-alpha.5", | ||
"homepage": "https://tiptap.dev", | ||
@@ -27,3 +27,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "a884cb81de8783d0097741c1ddb97a82ea88ae0e" | ||
"gitHead": "0371cb0a5d803a44d93532aa34419ec7ffffdc24" | ||
} |
@@ -1,68 +0,5 @@ | ||
import { | ||
Command, | ||
Mark, | ||
getMarkAttributes, | ||
mergeAttributes, | ||
} from '@tiptap/core' | ||
import { TextStyle } from './text-style' | ||
export interface TextStyleOptions { | ||
HTMLAttributes: { | ||
[key: string]: any | ||
}, | ||
} | ||
export * from './text-style' | ||
const TextStyle = Mark.create({ | ||
name: 'textStyle', | ||
defaultOptions: <TextStyleOptions>{ | ||
HTMLAttributes: {}, | ||
}, | ||
parseHTML() { | ||
return [ | ||
{ | ||
tag: 'span', | ||
getAttrs: element => { | ||
const hasStyles = (element as HTMLElement).hasAttribute('style') | ||
if (!hasStyles) { | ||
return false | ||
} | ||
return {} | ||
}, | ||
}, | ||
] | ||
}, | ||
renderHTML({ HTMLAttributes }) { | ||
return ['span', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0] | ||
}, | ||
addCommands() { | ||
return { | ||
/** | ||
* Remove spans without inline style attributes. | ||
*/ | ||
removeEmptyTextStyle: (): Command => ({ state, commands }) => { | ||
const attributes = getMarkAttributes(state, this.type) | ||
const hasStyles = Object.entries(attributes).every(([, value]) => !!value) | ||
if (hasStyles) { | ||
return true | ||
} | ||
return commands.unsetMark('textStyle') | ||
}, | ||
} | ||
}, | ||
}) | ||
export default TextStyle | ||
declare module '@tiptap/core' { | ||
interface AllExtensions { | ||
TextStyle: typeof TextStyle, | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
21490
16
216