vue-editify 0.1.45 → 0.1.47

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-editify",
3
- "version": "0.1.45",
3
+ "version": "0.1.47",
4
4
  "private": false,
5
5
  "sideEffects": [
6
6
  "*.css"
@@ -17,7 +17,7 @@
17
17
  "lib": "vue-tsc && vite build"
18
18
  },
19
19
  "dependencies": {
20
- "alex-editor": "^1.4.8",
20
+ "alex-editor": "^1.4.9",
21
21
  "dap-util": "^1.5.4",
22
22
  "highlight.js": "^11.8.0",
23
23
  "katex": "^0.16.10",
@@ -263,13 +263,9 @@
263
263
  height: auto;
264
264
  border-radius: 2px;
265
265
  vertical-align: text-bottom;
266
- margin: 0 2px;
266
+ margin: 0;
267
267
  max-width: 100%;
268
268
  min-width: 100px;
269
-
270
- &:hover {
271
- cursor: pointer;
272
- }
273
269
  }
274
270
  //视频样式
275
271
  :deep(video) {
@@ -280,7 +276,7 @@
280
276
  vertical-align: text-bottom;
281
277
  background-color: #000;
282
278
  object-fit: contain;
283
- margin: 0 2px;
279
+ margin: 0;
284
280
  max-width: 100%;
285
281
  min-width: 100px;
286
282
  }
@@ -375,7 +375,7 @@ const documentMouseDown = (e: Event) => {
375
375
  else if (['img', 'video'].includes(element.parsedom!)) {
376
376
  const rect = DapElement.getElementBounding(elm)
377
377
  //在可拖拽范围内
378
- if ((event.pageX >= Math.abs(rect.left + elm.offsetWidth - 10) && event.pageX <= Math.abs(rect.left + elm.offsetWidth)) || (event.pageX >= Math.abs(rect.left) && event.pageX <= Math.abs(rect.left + 10))) {
378
+ if (event.pageX >= Math.abs(rect.left + elm.offsetWidth - 10) && event.pageX <= Math.abs(rect.left + elm.offsetWidth)) {
379
379
  resizeParams.value.element = element
380
380
  resizeParams.value.start = event.pageX
381
381
  }
@@ -393,10 +393,21 @@ const documentMouseMove = (e: Event) => {
393
393
  if (props.disabled) {
394
394
  return
395
395
  }
396
+ const event = e as MouseEvent
397
+ const elm = e.target as HTMLElement
398
+ //如果鼠标在图片和视频上
399
+ if (DapElement.isContains(contentRef.value!, elm) && ['img', 'video'].includes(elm.tagName.toLocaleLowerCase())) {
400
+ const rect = DapElement.getElementBounding(elm)
401
+ //在可拖拽范围内改变鼠标样式
402
+ if (event.pageX >= Math.abs(rect.left + elm.offsetWidth - 10) && event.pageX <= Math.abs(rect.left + elm.offsetWidth)) {
403
+ elm.style.cursor = 'col-resize'
404
+ } else {
405
+ elm.style.cursor = ''
406
+ }
407
+ }
396
408
  if (!resizeParams.value.element) {
397
409
  return
398
410
  }
399
- const event = e as MouseEvent
400
411
  //表格列宽拖拽
401
412
  if (resizeParams.value.element.parsedom == 'td') {
402
413
  const tables = getMatchElementsByRange(editor.value!, dataRangeCaches.value, { parsedom: 'table' })
@@ -425,6 +436,7 @@ const documentMouseMove = (e: Event) => {
425
436
  }
426
437
  }
427
438
  resizeParams.value.element.elm!.style.width = width
439
+ //视频宽度改变的同时需要设置高度
428
440
  if (resizeParams.value.element.parsedom == 'video') {
429
441
  setVideoHeight()
430
442
  }
package/src/index.ts CHANGED
@@ -19,7 +19,7 @@ const install: FunctionPlugin = (app: App) => {
19
19
  app.component(Editify.name!, Editify)
20
20
  }
21
21
  //版本号
22
- const version = '0.1.45'
22
+ const version = '0.1.47'
23
23
 
24
24
  //导出AlexElement元素
25
25
  export { AlexElement } from 'alex-editor'