update 0.13.2
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
## 0.13.2
|
||||
|
||||
修复自定义动画可能失效问题。
|
||||
|
||||
## 0.13.1
|
||||
|
||||
修复定制动画重载画布的编辑问题。
|
||||
|
@@ -1,10 +1,12 @@
|
||||
---
|
||||
title: change log
|
||||
title: Change log
|
||||
toc: menu
|
||||
nav:
|
||||
title: change log
|
||||
title: Change log
|
||||
order: 6
|
||||
---
|
||||
## 0.13.2
|
||||
Fixed possible invalidation of custom animation.
|
||||
## 0.13.1
|
||||
Fixed editing problem of custom animation overloaded canvas.
|
||||
## 0.13.0
|
||||
|
@@ -5,6 +5,10 @@ nav:
|
||||
title: 变更日志
|
||||
order: 6
|
||||
---
|
||||
## 0.13.2
|
||||
|
||||
修复自定义动画可能失效问题。
|
||||
|
||||
## 0.13.1
|
||||
|
||||
修复定制动画重载画布的编辑问题。
|
||||
|
@@ -585,7 +585,7 @@ function AnimateControl(props: AnimateControlProps) {
|
||||
setDeletModal(false);
|
||||
}}
|
||||
>
|
||||
<Table columns={columns} dataSource={customAnimate}></Table>
|
||||
<Table columns={columns} dataSource={customAnimate} pagination={false}></Table>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "0.13.1",
|
||||
"version": "0.13.2",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/dooringx-lib.esm.js",
|
||||
|
@@ -33,15 +33,34 @@ export interface TransformItem {
|
||||
animateName: string;
|
||||
keyframes: TransformItemObj[];
|
||||
}
|
||||
|
||||
export const styleSheetId = 'dooringx_dynamic_style';
|
||||
export class AnimateFactory {
|
||||
constructor(public customAnimateName: Array<CustomAnimateObj> = []) {}
|
||||
|
||||
getCustomAnimateName() {
|
||||
return this.customAnimateName;
|
||||
}
|
||||
searchSheet(): null | CSSStyleSheet {
|
||||
let sheet: null | CSSStyleSheet = null;
|
||||
Array.from(document.styleSheets).forEach((v) => {
|
||||
const node = v?.ownerNode as Element;
|
||||
if (node?.id === styleSheetId) {
|
||||
sheet = v;
|
||||
}
|
||||
});
|
||||
return sheet;
|
||||
}
|
||||
|
||||
getStyleSheets() {
|
||||
return document.styleSheets;
|
||||
let sheet = this.searchSheet();
|
||||
if (!sheet) {
|
||||
let style = document.createElement('style');
|
||||
style.id = styleSheetId;
|
||||
style.appendChild(document.createTextNode(''));
|
||||
document.head.appendChild(style);
|
||||
}
|
||||
sheet = this.searchSheet();
|
||||
return sheet;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,32 +70,8 @@ export class AnimateFactory {
|
||||
* @memberof AnimateFactory
|
||||
*/
|
||||
inserKeyframeAnimate(ruleText: string) {
|
||||
const sheets = this.getStyleSheets();
|
||||
if (sheets.length === 0) {
|
||||
let style = document.createElement('style');
|
||||
style.appendChild(document.createTextNode(''));
|
||||
document.head.appendChild(style);
|
||||
}
|
||||
// const len = sheets.length;
|
||||
// let ss: number | null = null;
|
||||
// let st: number | null = null;
|
||||
// for (let i = 0; i < len; i++) {
|
||||
// for (let k = 0; k < sheets[i].cssRules.length; k++) {
|
||||
// const rule = sheets[i].cssRules[k] as CSSKeyframesRule;
|
||||
// const name = rule?.name;
|
||||
// if (name && name === keyframeName) {
|
||||
// // 删除该keyframe
|
||||
// ss = i;
|
||||
// st = k;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (ss !== null && st !== null) {
|
||||
// sheets[ss].deleteRule(st);
|
||||
// }
|
||||
// let sheet = sheets[ss ? ss : sheets.length - 1] as CSSStyleSheet;
|
||||
let sheet = sheets[0] as CSSStyleSheet; // 末尾的经常存在重复覆盖的问题
|
||||
sheet.insertRule(ruleText, sheet.cssRules.length);
|
||||
const sheet = this.getStyleSheets();
|
||||
if (sheet) sheet.insertRule(ruleText, sheet.cssRules.length);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,21 +83,20 @@ export class AnimateFactory {
|
||||
*/
|
||||
deleteKeyFrameAnimate(animateName: string) {
|
||||
const sheets = this.getStyleSheets();
|
||||
if (sheets.length === 0) {
|
||||
if (!sheets) {
|
||||
return;
|
||||
}
|
||||
const sheet = sheets[0] as CSSStyleSheet;
|
||||
const len = sheet.cssRules.length;
|
||||
const len = sheets.cssRules.length;
|
||||
let ss = null;
|
||||
for (let i = 0; i < len; i++) {
|
||||
const rule = sheet.cssRules[i] as CSSKeyframesRule;
|
||||
const rule = sheets.cssRules[i] as CSSKeyframesRule;
|
||||
const name = rule?.name;
|
||||
if (name && name === animateName) {
|
||||
ss = i;
|
||||
}
|
||||
}
|
||||
if (ss !== null) {
|
||||
sheet.deleteRule(ss);
|
||||
sheets.deleteRule(ss);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "dooringx-plugin-template",
|
||||
"version": "0.13.1",
|
||||
"version": "0.13.2",
|
||||
"description": "> TODO: description",
|
||||
"author": "yehuozhili <673632758@qq.com>",
|
||||
"homepage": "https://github.com/H5-Dooring/dooringx#readme",
|
||||
|
@@ -40,7 +40,7 @@
|
||||
"@rollup/plugin-node-resolve": "^13.0.4",
|
||||
"@rollup/plugin-url": "^6.1.0",
|
||||
"@svgr/rollup": "^5.5.0",
|
||||
"dooringx-lib": "^0.13.1",
|
||||
"dooringx-lib": "^0.13.2",
|
||||
"postcss": "^8.3.6",
|
||||
"rollup-plugin-peer-deps-external": "^2.2.4",
|
||||
"rollup-plugin-postcss": "^4.0.1",
|
||||
|
@@ -51,6 +51,7 @@ const concatResult = (result) => {
|
||||
//替换Title:
|
||||
if (v.src.startsWith('title:') && v.dst.startsWith('Title:')) {
|
||||
v.dst = v.dst.replace('Title:', 'title:');
|
||||
v.dst = v.dst.replace('change log', 'Change log');
|
||||
}
|
||||
const fi = v.src.startsWith('##') ? v.src : v.dst;
|
||||
if (i > navstart && i < line) {
|
||||
|
Reference in New Issue
Block a user