|
@@ -6,7 +6,13 @@ import {
|
|
|
getNewPage,
|
|
|
getTopicHeadModel,
|
|
|
} from "../elementModel";
|
|
|
-import { objAssign, deepCopy, calcSum, getElementId } from "../plugins/utils";
|
|
|
+import {
|
|
|
+ objAssign,
|
|
|
+ deepCopy,
|
|
|
+ calcSum,
|
|
|
+ getElementId,
|
|
|
+ randomCode,
|
|
|
+} from "../plugins/utils";
|
|
|
|
|
|
const state = {
|
|
|
cardConfig: {},
|
|
@@ -191,7 +197,8 @@ const checkElementisCovered = (id, type) => {
|
|
|
return elementHeights.some((item) => item > limitHeight);
|
|
|
}
|
|
|
|
|
|
- return elementDom.offsetHeight < elementDom.firstChild.offsetHeight;
|
|
|
+ // return elementDom.offsetHeight < elementDom.firstChild.offsetHeight;
|
|
|
+ return false;
|
|
|
};
|
|
|
|
|
|
const createFunc = {
|
|
@@ -523,6 +530,7 @@ const actions = {
|
|
|
|
|
|
let newElement = Object.assign({}, curElement, {
|
|
|
id: getElementId(),
|
|
|
+ key: randomCode(),
|
|
|
elements: [],
|
|
|
h: 200,
|
|
|
isExtend: true,
|
|
@@ -621,7 +629,19 @@ const actions = {
|
|
|
const elementDom = document.getElementById(`preview-${element.id}`);
|
|
|
|
|
|
if (elementDom) {
|
|
|
- element.h = elementDom.offsetHeight;
|
|
|
+ if (element.type === "FILL_QUESTION" || element.type === "FILL_LINE") {
|
|
|
+ const elementH = Math.max(
|
|
|
+ elementDom.lastChild.offsetHeight,
|
|
|
+ elementDom.offsetHeight
|
|
|
+ );
|
|
|
+ if (elementH !== element.h) {
|
|
|
+ element.key = randomCode();
|
|
|
+ element.minHeight = elementDom.lastChild.offsetHeight;
|
|
|
+ element.h = elementH;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ element.h = elementDom.offsetHeight;
|
|
|
+ }
|
|
|
element.w = elementDom.offsetWidth;
|
|
|
// 解答题小题与其他题有些区别。
|
|
|
// 其他题都是通过内部子元素自动撑高元件,而解答题则需要手动设置高度。
|