questionhead.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. import $ from '../util/dom-core.js';
  2. import { getParentByClassname } from '../util/util.js';
  3. import QrCode from 'jr-qrcode';
  4. let tipsTemplate = `
  5. <p style='font-size: 12px; margin: 0; padding: 0 10px; line-height: 20px;'>1、考号、姓名、班级三项信息必须用黑色签字笔填清楚。</p>
  6. <p style='font-size: 12px; margin: 0; padding: 0 10px; line-height: 20px;'>2、选择题作答必须用2B铅笔填涂,非选择题作答必须用黑色中性笔或黑色墨迹钢笔填写。</p>
  7. <p style='font-size: 12px; margin: 0; padding: 0 10px; line-height: 20px;' >3、必须在指定区域答题,且不得超出黑色答题框。</p>
  8. <p style='font-size: 12px; margin: 0; padding: 0 10px; line-height: 20px;'>4、请保持答题卡卡面清洁,不要折叠或弄破答题卡。</p>
  9. `;
  10. /**
  11. * 初始化答题卡头外层框样式
  12. * @param {DomElement} $head 头框
  13. */
  14. function initStyleHeader ($head) {
  15. $head.css('min-height', '100px')
  16. .css('overflow', 'hidden')
  17. .css('outline', 'none')
  18. .css('font-size', '0px');
  19. }
  20. /**
  21. * 初始化答题卡头标题框样式
  22. * @param {DomElement} $title 标题框
  23. */
  24. function initStyleTitle ($title) {
  25. $title.css('padding', '5px 0')
  26. .css('overflow', 'hidden')
  27. .css('outline', 'none')
  28. .css('font-weight', '600')
  29. .css('line-height', '25px')
  30. .css('min-height', '25px')
  31. .css('height', 'auto')
  32. .css('font-size', '18px')
  33. .css('max-height', '75px')
  34. .css('text-align', 'center');
  35. }
  36. /**
  37. * 初始化答题卡头标题框样式
  38. * @param {DomElement} $body 标题框
  39. */
  40. function initStyleBody ($body) {
  41. $body.css('border', '1px solid rgb(0, 0, 0)')
  42. .css('overflow', 'hidden')
  43. .css('min-height', '100px')
  44. .css('height', 'auto')
  45. .css('font-size', '0');
  46. }
  47. /**
  48. * 生成卡头基本信息
  49. * @param {string} 卡头基本信息宽度
  50. */
  51. function generateBasicInfo (width, data, pindex) {
  52. let $box = $('<div class="js-basic-head-info-box"></div>')
  53. $box.css('width', width).css('float', 'left').css('border-right', '1px solid #000').css('padding', '10px 0').css('position', 'relative').css('min-height', '120px');
  54. let $name = $('<div></div>');
  55. $name.css('width', '100%');
  56. let $label = $('<div>姓名:</div>');
  57. $label.css('display', 'inline-block')
  58. .css('line-height', '25px')
  59. .css('font-size', '14px')
  60. .css('margin-right', '15px')
  61. .css('width', '40px')
  62. .css('text-align', 'right');
  63. let $line = $('<div>&#8203;</div>');
  64. $line.css('display', 'inline-block')
  65. .css('width', '130px')
  66. .css('line-height', '25px')
  67. .css('font-size', '14px')
  68. .css('border-bottom', '1px solid #000');
  69. $name.append($label);
  70. $name.append($line);
  71. let $class = $('<div></div>');
  72. $class.css('width', '100%');
  73. let $labelclass = $('<div>班级:</div>');
  74. $labelclass.css('display', 'inline-block')
  75. .css('line-height', '25px')
  76. .css('font-size', '14px')
  77. .css('margin-top', '10px')
  78. .css('margin-right', '15px')
  79. .css('width', '40px')
  80. .css('text-align', 'right');
  81. let $lineclass = $('<div>&#8203;</div>');
  82. $lineclass.css('display', 'inline-block')
  83. .css('width', '130px')
  84. .css('line-height', '25px')
  85. .css('font-size', '14px')
  86. .css('border-bottom', '1px solid #000');
  87. $class.append($labelclass);
  88. $class.append($lineclass);
  89. let mode = parseInt(data.noMode);
  90. let src = QrCode.getQrBase64('+' + data.qrCode + '' + (pindex + 1), {
  91. width: 100, // 二维码图片宽度(默认为256px)
  92. height: 100, // 二维码图片高度(默认为256px)
  93. padding: 5
  94. });
  95. let $qrcode = $('<div class="js-lsiten-qrcode"><img src="' + src + '"/></div>');
  96. $qrcode.css('position', 'absolute').css('right', '5px').css('top', '5px').css('width', '100px').css('height', '100px');
  97. if (mode === 1) {
  98. let $xh = $('<div></div>');
  99. $xh.css('width', '100%').css('margin-bottom', '10px');
  100. let $labelxh = $('<div>学号:</div>');
  101. $labelxh.css('display', 'inline-block')
  102. .css('line-height', '25px')
  103. .css('font-size', '14px')
  104. .css('margin-top', '10px')
  105. .css('margin-right', '15px')
  106. .css('width', '40px')
  107. .css('text-align', 'right');
  108. let $linexh = $('<div>&#8203;</div>');
  109. $linexh.css('display', 'inline-block')
  110. .css('width', '130px')
  111. .css('line-height', '25px')
  112. .css('font-size', '14px')
  113. .css('border-bottom', '1px solid #000');
  114. $xh.append($labelxh);
  115. $xh.append($linexh);
  116. $box.append($xh);
  117. $qrcode.css('top', '15px');
  118. $box.css('padding', 0)
  119. }
  120. $box.append($name);
  121. $box.append($class);
  122. $box.append($qrcode);
  123. return $box;
  124. }
  125. /**
  126. * 生成卡头基本信息
  127. * @param {string} 卡头基本信息宽度
  128. */
  129. function generateBasicInfo_2 (width, data, pindex) {
  130. let $box = $('<div class="js-basic-head-info-box"></div>')
  131. $box.css('width', width).css('float', 'left').css('border-right', '1px solid #000').css('padding', '10px 0').css('position', 'relative').css('min-height', '120px');
  132. let $name = $('<div></div>');
  133. $name.css('width', '100%');
  134. let $label = $('<div>姓名:</div>');
  135. $label.css('display', 'inline-block')
  136. .css('line-height', '25px')
  137. .css('font-size', '14px')
  138. .css('margin-right', '15px')
  139. .css('width', '40px')
  140. .css('text-align', 'right');
  141. let $line = $('<div>&#8203;</div>');
  142. $line.css('display', 'inline-block')
  143. .css('width', '130px')
  144. .css('line-height', '25px')
  145. .css('font-size', '14px')
  146. .css('border-bottom', '1px solid #000');
  147. $name.append($label);
  148. $name.append($line);
  149. let $class = $('<div></div>');
  150. $class.css('width', '100%');
  151. let $labelclass = $('<div>班级:</div>');
  152. $labelclass.css('display', 'inline-block')
  153. .css('line-height', '25px')
  154. .css('font-size', '14px')
  155. .css('margin-top', '10px')
  156. .css('margin-right', '15px')
  157. .css('width', '40px')
  158. .css('text-align', 'right');
  159. let $lineclass = $('<div>&#8203;</div>');
  160. $lineclass.css('display', 'inline-block')
  161. .css('width', '130px')
  162. .css('line-height', '25px')
  163. .css('font-size', '14px')
  164. .css('border-bottom', '1px solid #000');
  165. $class.append($labelclass);
  166. $class.append($lineclass);
  167. let mode = parseInt(data.noMode);
  168. let src = QrCode.getQrBase64('+' + data.qrCode + '' + (pindex + 1), {
  169. width: 100, // 二维码图片宽度(默认为256px)
  170. height: 100, // 二维码图片高度(默认为256px)
  171. padding: 5
  172. });
  173. let $qrcode = $('<div class="js-lsiten-qrcode"><img src="' + src + '"/></div>');
  174. $qrcode.css('position', 'absolute').css('right', '60px').css('top', '78px').css('width', '100px').css('height', '100px');
  175. if (mode === 1) {
  176. let $xh = $('<div></div>');
  177. $xh.css('width', '100%').css('margin-bottom', '10px');
  178. let $labelxh = $('<div>学号:</div>');
  179. $labelxh.css('display', 'inline-block')
  180. .css('line-height', '25px')
  181. .css('font-size', '14px')
  182. .css('margin-top', '10px')
  183. .css('margin-right', '15px')
  184. .css('width', '40px')
  185. .css('text-align', 'right');
  186. let $linexh = $('<div>&#8203;</div>');
  187. $linexh.css('display', 'inline-block')
  188. .css('width', '130px')
  189. .css('line-height', '25px')
  190. .css('font-size', '14px')
  191. .css('border-bottom', '1px solid #000');
  192. $xh.append($labelxh);
  193. $xh.append($linexh);
  194. $box.append($xh);
  195. $qrcode.css('top', '15px');
  196. $box.css('padding', 0)
  197. }
  198. $box.append($name);
  199. $box.append($class);
  200. $box.append($qrcode);
  201. return $box;
  202. }
  203. /**
  204. * 生成条码区
  205. */
  206. function generateBarCode () {
  207. let $box = $('<div></div>')
  208. $box.css('width', '50%').css('height', '100%').css('font-size', '18px').css('float', 'left').css('padding', '10px 0');
  209. let $message = $('<div><p>条形码粘贴处</p><p style="font-size: 12px">(正面朝上,切勿贴出框外)</p></div>');
  210. $message.css('width', '200px')
  211. .css('height', '120px')
  212. .css('text-align', 'center')
  213. .css('line-height', '50px')
  214. .css('margin', '0 auto');
  215. $box.append($message);
  216. return $box;
  217. }
  218. /**
  219. * 生成模板1
  220. * @param {JSON} data 头部信息
  221. */
  222. function headType1 (data, pindex) {
  223. let title = data.alias || '';
  224. let $head = $('<div class="js-answer-header" contenteditable="false"></div>');
  225. initStyleHeader($head);
  226. let $title = $('<div class="js-answer-header-title" contenteditable = "true">' + title + '</div>');
  227. initStyleTitle($title);
  228. let $body = $('<div class="js-answer-header-body"></div>');
  229. initStyleBody($body);
  230. let $tips = $('<div class="js-answer-head-tips"></div>');
  231. $tips.css('padding', '5px 0');
  232. $tips.html(tipsTemplate);
  233. let $bottom = $('<div class="js-head-bottom"></div>');
  234. $bottom.css('width', '100%')
  235. .css('border-top', '1px solid #000')
  236. .css('overflow', 'hidden')
  237. .css('height', 'auto')
  238. .css('font-size', '0');
  239. let $basicInfo = $('<div class="js-answer-head-basic"></div>');
  240. $basicInfo.css('width', '50%')
  241. .css('float', 'left')
  242. .css('padding-bottom', '10px')
  243. .css('font-size', '0');
  244. let $basic = generateBasicInfo('50%', data, pindex);
  245. $basic.css('border-right', 'none');
  246. $bottom.append($basic);
  247. let $barCode = generateBarCode();
  248. $barCode.css('border-left', '1px solid #000');
  249. $bottom.append($barCode);
  250. $body.append($tips);
  251. $body.append($bottom);
  252. $head.append($title);
  253. $head.append($body);
  254. return $head;
  255. }
  256. /**
  257. * 生成模板2
  258. * @param {int} noCount 准考证号位数
  259. * @param {JSON} data 头部信息
  260. */
  261. function headType2 (noCount, data, pindex) {
  262. let title = data.alias || '';
  263. let $head = $('<div class="js-answer-header" contenteditable="false"></div>');
  264. initStyleHeader($head);
  265. let $title = $('<div class="js-answer-header-title" contenteditable = "true">' + title + '</div>');
  266. initStyleTitle($title);
  267. let $body = $('<div class="js-answer-header-body"></div>');
  268. initStyleBody($body);
  269. let $leftBox = $('<div></div>');
  270. $leftBox.css('width', '50%')
  271. .css('float', 'left')
  272. .css('font-size', '0');
  273. let $basicInfo = $('<div class="js-answer-head-basic"></div>');
  274. $basicInfo.css('width', '100%')
  275. .css('float', 'left')
  276. .css('border-bottom', '1px solid #000')
  277. .css('font-size', '0');
  278. let $basic = generateBasicInfo('100%', data, pindex);
  279. $basic.css('border-right', 'none')
  280. $basicInfo.append($basic);
  281. let $tips = $('<div class="js-answer-head-tips"></div>');
  282. $tips.css('padding', '18px 0').css('float', 'left');
  283. $tips.html(tipsTemplate);
  284. $leftBox.append($basicInfo);
  285. $leftBox.append($tips);
  286. $body.append($leftBox);
  287. let $rightBox = $('<div></div>');
  288. $rightBox.css('width', '50%')
  289. .css('float', 'left')
  290. .css('position', 'relative')
  291. .css('padding', '5px')
  292. .css('min-height', '293px')
  293. .css('font-size', '0');
  294. $rightBox.css('border-left', '1px solid #000');
  295. let $examNumberBox = generateExamNumber(noCount);
  296. $rightBox.append($examNumberBox);
  297. $body.append($rightBox);
  298. $head.append($title);
  299. $head.append($body);
  300. return $head;
  301. }
  302. /**
  303. * 生成模板3
  304. * @param {int} noCount 准考证号位数
  305. * @param {JSON} data 头部信息
  306. */
  307. function headType3 (noCount, data, pindex) {
  308. let title = data.alias || '';
  309. let $head = $('<div class="js-answer-header" contenteditable="false"></div>');
  310. initStyleHeader($head);
  311. let $title = $('<div class="js-answer-header-title" contenteditable = "true">' + title + '</div>');
  312. initStyleTitle($title);
  313. let $body = $('<div class="js-answer-header-body"></div>');
  314. initStyleBody($body);
  315. let $top = $('<div></div>');
  316. $top.css('overflow', 'hidden');
  317. let $left = $('<div></div>');
  318. $left.css('float', 'left').css('width', '50%').css('border-right', '1px solid #000');
  319. let $basic = generateBasicInfo('100%', data, pindex);
  320. $basic.css('border', 'none').css('margin-top', '24px');
  321. $left.append($basic);
  322. let $right = $('<div></div>');
  323. $right.css('float', 'left').css('width', '50%');
  324. let $tips = $('<div class="js-answer-head-tips"></div>');
  325. $tips.css('padding', '15px 0').css('float', 'left');
  326. $tips.html(tipsTemplate);
  327. $right.append($tips);
  328. $top.append($left);
  329. $top.append($right);
  330. let $bottom = $('<div></div>');
  331. $bottom.css('overflow', 'hidden').css('border-top', '1px solid #000').css('position', 'relative').css('padding', '5px 15px').css('font-size', '0').css('min-height','293px');
  332. let $examNumberBox = generateExamNumber(noCount);
  333. $bottom.append($examNumberBox);
  334. $body.append($top);
  335. $body.append($bottom);
  336. $head.append($title);
  337. $head.append($body);
  338. return $head;
  339. }
  340. /**
  341. * 生成模板3
  342. * @param {int} noCount 准考证号位数
  343. * @param {JSON} data 头部信息
  344. */
  345. function headType4 (noCount, data, pindex) {
  346. let title = data.alias || '';
  347. let $head = $('<div class="js-answer-header" contenteditable="false"></div>');
  348. initStyleHeader($head);
  349. let $title = $('<div class="js-answer-header-title" contenteditable = "true">' + title + '</div>');
  350. initStyleTitle($title);
  351. let $body = $('<div class="js-answer-header-body"></div>');
  352. initStyleBody($body);
  353. let $top = $('<div></div>');
  354. $top.css('overflow', 'hidden');
  355. let $left = $('<div></div>');
  356. $left.css('float', 'left').css('width', '50%');
  357. let $basic = generateBasicInfo_2('100%', data, pindex);
  358. $basic.css('border', 'none').css('margin-top', '24px');
  359. $left.append($basic);
  360. let $right = $('<div></div>');
  361. $right.css('float', 'left').css('width', '50%').css('border-left', '1px solid #000');
  362. let $tips = $('<div class="js-answer-head-tips"></div>');
  363. $tips.css('padding', '15px 0').css('float', 'left');
  364. $tips.html(tipsTemplate);
  365. $right.append($tips);
  366. $top.append($left);
  367. $top.append($right);
  368. let $bottom = $('<div></div>');
  369. $bottom.css('overflow', 'hidden').css('border-top', '1px solid #000').css('position', 'relative').css('padding', '5px 15px').css('font-size', '0').css('min-height','293px');
  370. let $examNumberBox = generateExamNumber(noCount);
  371. $bottom.append($examNumberBox);
  372. $body.append($top);
  373. $body.append($bottom);
  374. $head.append($title);
  375. $head.append($body);
  376. return $head;
  377. }
  378. /**
  379. * 生成模板1
  380. * @param {JSON} data 头部信息
  381. */
  382. function headType5 (data, pindex) {
  383. let title = data.alias || '';
  384. let $head = $('<div class="js-answer-header" contenteditable="false"></div>');
  385. initStyleHeader($head);
  386. let $title = $('<div class="js-answer-header-title" contenteditable = "true">' + title + '</div>');
  387. initStyleTitle($title);
  388. let $body = $('<div class="js-answer-header-body"></div>');
  389. initStyleBody($body);
  390. let $tips = $('<div class="js-answer-head-tips"></div>');
  391. $tips.css('padding', '5px 0');
  392. $tips.html(tipsTemplate);
  393. let $bottom = $('<div class="js-head-bottom"></div>');
  394. $bottom.css('width', '100%')
  395. .css('border-top', '1px solid #000')
  396. .css('overflow', 'hidden')
  397. .css('height', 'auto')
  398. .css('font-size', '0');
  399. let $basicInfo = $('<div class="js-answer-head-basic"></div>');
  400. $basicInfo.css('width', '50%')
  401. .css('float', 'left')
  402. .css('padding-bottom', '10px')
  403. .css('font-size', '0');
  404. let $basic = generateBasicInfo('50%', data, pindex);
  405. $basic.css('border-right', 'none');
  406. $bottom.append($basic);
  407. let $barCode = generateBarCode();
  408. $barCode.css('border-left', '1px solid #000');
  409. $bottom.append($barCode);
  410. $body.append($tips);
  411. $body.append($bottom);
  412. $head.append($title);
  413. $head.append($body);
  414. return $head;
  415. }
  416. /**
  417. * 生成准考证号框
  418. * @param {int} noCount 准考证号位数
  419. */
  420. function generateExamNumber (noCount) {
  421. let allWidth = noCount * 32 + 2;
  422. if (noCount <= 1) {
  423. allWidth = 2 * 32 + 2;
  424. }
  425. let $box = $('<div></div>');
  426. $box.css('margin', '5px auto')
  427. .css('display', 'inline-block')
  428. .css('width', allWidth + 'px')
  429. .css('overflow', 'hidden')
  430. .css('position', 'absolute')
  431. .css('left', '50%')
  432. .css('margin-left', '-' + allWidth / 2 + 'px')
  433. .css('top', '0')
  434. .css('border', '1px solid #000');
  435. let $title = $('<div>准考证号</div>');
  436. $title.css('text-align', 'center')
  437. .css('float', 'left')
  438. .css('font-size', '14px')
  439. .css('height', '24px')
  440. .css('line-height', '23px')
  441. .css('border-bottom', '1px solid #000')
  442. .css('text-align', 'center');
  443. $box.append($title);
  444. let $inputGrid = $('<div></div>');
  445. $inputGrid.css('border-bottom', '1px solid #000').css('float', 'left').css('height', '22px').css('line-height', '21px');
  446. let lastIndex = noCount - 1;
  447. let width = '32px';
  448. for (let i =0; i < noCount; i++) {
  449. let $colums = $('<div>&#8203;</div>');
  450. $colums.css('width', width).css('font-size', '12px').css('display', 'inline-block').css('float', 'left');
  451. i < lastIndex && ($colums.css('border-right', '1px solid #000'));
  452. $inputGrid.append($colums);
  453. }
  454. $box.append($inputGrid);
  455. for (let j = 0; j <= 9; j++) {
  456. let $row = $('<div></div>');
  457. $row.css('float', 'left').css('height', '21px').css('line-height', '21px');
  458. for (let i =0; i < noCount; i++) {
  459. let $colums = $('<div></div>');
  460. $colums.css('width', width).css('font-size', '12px').css('display', 'inline-block').css('text-align', 'center').css('float', 'left');
  461. i < lastIndex && ($colums.css('border-right', '1px solid #000'));
  462. let $columnBox = $('<div>'+j+'</div>');
  463. $columnBox.css('display', 'inline-block').css('width', '19px').css('border', '1px solid #000').css('line-height', '0.95');
  464. $colums.append($columnBox);
  465. $row.append($colums);
  466. j === 9 && ($colums.css('padding-bottom', '12px'), $row.css('height', '33px'));
  467. j === 0 && ($colums.css('padding-top', '12px'), $row.css('height', '33px'));
  468. }
  469. $box.append($row);
  470. }
  471. return $box;
  472. }
  473. let heads = {
  474. 'A4_1_1_1': function (noCount, data, pindex) {
  475. return headType1(data, pindex);
  476. },
  477. 'A4_1_1_2': function (noCount, data, pindex) {
  478. return headType1(data, pindex);
  479. },
  480. 'A4_2_1_1': function (noCount, data, pindex) {
  481. return headType2(noCount, data, pindex);
  482. },
  483. 'A4_2_1_2': function (noCount, data, pindex) {
  484. return headType3(noCount, data, pindex);
  485. },
  486. 'A3_1_2_1': function (noCount, data, pindex) {
  487. return headType1(data, pindex);
  488. },
  489. 'A3_1_2_2': function (noCount, data, pindex) {
  490. return headType1(data, pindex);
  491. },
  492. 'A3_2_2_1': function (noCount, data, pindex) {
  493. return headType2(noCount, data, pindex);
  494. },
  495. 'A3_2_2_2': function (noCount, data, pindex) {
  496. return headType3(noCount, data, pindex);
  497. },
  498. 'A3_1_3_1': function (noCount, data, pindex) {
  499. return headType5(data, pindex);
  500. },
  501. 'A3_1_3_2': function (noCount, data, pindex) {
  502. return headType5(data, pindex);
  503. },
  504. 'A3_2_3_1': function (noCount, data, pindex) {
  505. return headType4(noCount, data, pindex);
  506. },
  507. 'A3_2_3_2': function (noCount, data, pindex) {
  508. return headType4(noCount, data, pindex);
  509. }
  510. }
  511. /**
  512. *
  513. * @param {Object} editor 编辑器对象
  514. * @param {String} key 生成头的类型key值
  515. * @param {DomElement} $page 生成头的页Dom
  516. */
  517. let generateQuestionHead = function (editor, key, $page) {
  518. debugger;
  519. let noCount = editor.noCount;
  520. let currentPage = $page || editor.page.currentPage;
  521. let $fisrstColumn = currentPage.$colums[0];
  522. let exitHead = $fisrstColumn.find('.js-answer-header');
  523. if (exitHead.length > 0) {
  524. editor.message.showMessage('该页已经有答题卡头!');
  525. return true;
  526. }
  527. let $header = heads[key](noCount, editor.data, currentPage.pageIndex);
  528. let $firstParagraph = $fisrstColumn[0].firstChild;
  529. if (!$firstParagraph) {
  530. $firstParagraph = currentPage.addParagraph();
  531. }
  532. $firstParagraph.append($header);
  533. $header.find('.js-answer-header-title').focus();
  534. if (editor.page) {
  535. editor.page._updatePositionInfo({}, $header);
  536. } else {
  537. setTimeout(() => {
  538. editor.page._updatePositionInfo({}, $header);
  539. },0)
  540. }
  541. return true;
  542. }
  543. export default {
  544. generateQuestionHead: generateQuestionHead
  545. }