@lobehub/editor 1.34.0 → 1.34.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -84,15 +84,16 @@ var LazyImage = /*#__PURE__*/memo(function (_ref) {
|
|
|
84
84
|
onError: onError,
|
|
85
85
|
onLoad: function onLoad(e) {
|
|
86
86
|
var img = e.currentTarget;
|
|
87
|
+
var width = Math.min(img.naturalWidth, img.getBoundingClientRect().width);
|
|
87
88
|
if (isSVGImage) {
|
|
88
89
|
setDimensions({
|
|
89
90
|
height: img.naturalHeight,
|
|
90
|
-
width:
|
|
91
|
+
width: width
|
|
91
92
|
});
|
|
92
93
|
}
|
|
93
94
|
_onLoad === null || _onLoad === void 0 || _onLoad({
|
|
94
95
|
height: img.naturalHeight,
|
|
95
|
-
width:
|
|
96
|
+
width: width
|
|
96
97
|
});
|
|
97
98
|
},
|
|
98
99
|
src: src,
|
|
@@ -6,7 +6,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { mergeRegister } from '@lexical/utils';
|
|
8
8
|
import { Block } from '@lobehub/ui';
|
|
9
|
-
import { $getSelection, COMMAND_PRIORITY_LOW, SELECTION_CHANGE_COMMAND, getDOMSelection } from 'lexical';
|
|
9
|
+
import { $getSelection, BLUR_COMMAND, COMMAND_PRIORITY_LOW, SELECTION_CHANGE_COMMAND, getDOMSelection } from 'lexical';
|
|
10
10
|
import { useCallback, useRef } from 'react';
|
|
11
11
|
import { useLexicalComposerContext, useLexicalEditor } from "../../../editor-kernel/react";
|
|
12
12
|
import { ILinkService } from "../../link";
|
|
@@ -113,6 +113,9 @@ export var ReactToolbarPlugin = function ReactToolbarPlugin(_ref) {
|
|
|
113
113
|
$updateTextFormatFloatingToolbar(editor);
|
|
114
114
|
}
|
|
115
115
|
return false;
|
|
116
|
+
}, COMMAND_PRIORITY_LOW), editor.registerCommand(BLUR_COMMAND, function () {
|
|
117
|
+
$hideFloatingToolbar();
|
|
118
|
+
return false;
|
|
116
119
|
}, COMMAND_PRIORITY_LOW), function () {
|
|
117
120
|
if (rootElement) {
|
|
118
121
|
rootElement.removeEventListener('mousedown', handleMouseDown);
|
package/package.json
CHANGED