mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-29 00:20:04 +01:00
chore: remove all console logs
This commit is contained in:
30
packages/editor/dist/components/button.js
vendored
30
packages/editor/dist/components/button.js
vendored
@@ -23,21 +23,42 @@ export function Button(props) {
|
||||
passive: false,
|
||||
capture: true,
|
||||
});
|
||||
// buttonRef.current.addEventListener("touchmove", onTouchMove, {
|
||||
// passive: false,
|
||||
// capture: true,
|
||||
// });
|
||||
// buttonRef.current.addEventListener("touchend", onTouchEnd, {
|
||||
// passive: false,
|
||||
// capture: true,
|
||||
// });
|
||||
// buttonRef.current.addEventListener("touchstart", onTouchStart, {
|
||||
// passive: false,
|
||||
// capture: true,
|
||||
// });
|
||||
return function () {
|
||||
var _a;
|
||||
(_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener("mousedown", onMouseDown, {
|
||||
capture: true,
|
||||
});
|
||||
// buttonRef.current?.removeEventListener("touchmove", onTouchMove, {
|
||||
// capture: true,
|
||||
// });
|
||||
// buttonRef.current?.removeEventListener("touchend", onTouchEnd, {
|
||||
// capture: true,
|
||||
// });
|
||||
// buttonRef.current?.removeEventListener("touchstart", onTouchStart, {
|
||||
// capture: true,
|
||||
// });
|
||||
};
|
||||
}, [buttonRef.current]);
|
||||
}, []);
|
||||
var onMouseDown = useCallback(function (e) {
|
||||
console.log("Preventing");
|
||||
e.preventDefault();
|
||||
}, []);
|
||||
// const onTouchEnd = useCallback((e) => {
|
||||
// e.preventDefault();
|
||||
// const now = Date.now();
|
||||
// setTimeout(() => {
|
||||
// console.log(now, touchStartTime.current);
|
||||
// if (touchStartTime.current === 0) return;
|
||||
// if (now - touchStartTime.current > 300) return;
|
||||
// //@ts-ignore
|
||||
@@ -46,8 +67,13 @@ export function Button(props) {
|
||||
// }, []);
|
||||
// const onTouchStart = useCallback((e) => {
|
||||
// touchStartTime.current = Date.now();
|
||||
// console.log("HELLO!");
|
||||
// e.preventDefault();
|
||||
// }, []);
|
||||
// const onTouchMove = useCallback((e) => {
|
||||
// console.log("HELLO!");
|
||||
// touchStartTime.current = 0;
|
||||
// }, []);
|
||||
return (_jsx(RebassButton, __assign({}, props, { ref: function (ref) {
|
||||
buttonRef.current = ref;
|
||||
// props.ref = ref;
|
||||
|
||||
@@ -75,7 +75,6 @@ var PopupRenderer = /** @class */ (function (_super) {
|
||||
var index = prev.popups.findIndex(function (p) { return p.id === id; });
|
||||
if (index <= -1)
|
||||
return prev;
|
||||
console.log(index, id, prev.popups[index]);
|
||||
var clone = prev.popups.slice();
|
||||
clone.splice(index, 1);
|
||||
return {
|
||||
@@ -88,7 +87,6 @@ var PopupRenderer = /** @class */ (function (_super) {
|
||||
PopupRenderer.prototype.render = function () {
|
||||
return (_jsxs(PopupRendererContext.Provider, __assign({ value: this }, { children: [this.props.children, _jsxs(EditorContext.Provider, __assign({ value: this.props.editor }, { children: [this.state.popups.map(function (_a) {
|
||||
var id = _a.id, Popup = _a.popup;
|
||||
console.log(id, Popup);
|
||||
return _jsx(Popup, {}, id);
|
||||
}), _jsx("div", { id: "popup-container" })] }))] })));
|
||||
};
|
||||
|
||||
@@ -38,7 +38,7 @@ export function MoreTools(props) {
|
||||
var isBottom = toolbarLocation === "bottom";
|
||||
var buttonRef = useRef();
|
||||
var _a = __read(useState(false), 2), isOpen = _a[0], setIsOpen = _a[1];
|
||||
return (_jsxs(_Fragment, { children: [_jsx(ToolButton, __assign({}, props, { toggled: isOpen, buttonRef: buttonRef, onMouseDown: function (e) { return e.preventDefault(); }, onClick: function () { return setIsOpen(function (s) { return !s; }); } })), _jsx(PopupWrapper, { isOpen: isOpen, group: "toolbarGroup", id: popupId, onClosed: function () { return setIsOpen(false); }, position: {
|
||||
return (_jsxs(_Fragment, { children: [_jsx(ToolButton, __assign({}, props, { toggled: isOpen, buttonRef: buttonRef, onClick: function () { return setIsOpen(function (s) { return !s; }); } })), _jsx(PopupWrapper, { isOpen: isOpen, group: "toolbarGroup", id: popupId, onClosed: function () { return setIsOpen(false); }, position: {
|
||||
isTargetAbsolute: true,
|
||||
target: isBottom ? getToolbarElement() : buttonRef.current || "mouse",
|
||||
align: "center",
|
||||
@@ -47,12 +47,6 @@ export function MoreTools(props) {
|
||||
}, autoCloseOnUnmount: autoCloseOnUnmount, focusOnRender: false, blocking: false, renderPopup: function () { return (_jsx(ToolbarGroup, { tools: tools, editor: editor, sx: {
|
||||
flex: 1,
|
||||
p: 1,
|
||||
// TODO: we cannot put a fix height here
|
||||
// since it differs from platform to platform.
|
||||
// perhaps we can use a expose a custom css class
|
||||
// or extend the theme.
|
||||
// px: isBottom ? 0 : 1,
|
||||
// height: "50px",
|
||||
boxShadow: "menu",
|
||||
bg: "background",
|
||||
borderRadius: "default",
|
||||
|
||||
@@ -14,15 +14,40 @@ export function Button(props: ButtonProps) {
|
||||
capture: true,
|
||||
});
|
||||
|
||||
// buttonRef.current.addEventListener("touchmove", onTouchMove, {
|
||||
// passive: false,
|
||||
// capture: true,
|
||||
// });
|
||||
|
||||
// buttonRef.current.addEventListener("touchend", onTouchEnd, {
|
||||
// passive: false,
|
||||
// capture: true,
|
||||
// });
|
||||
|
||||
// buttonRef.current.addEventListener("touchstart", onTouchStart, {
|
||||
// passive: false,
|
||||
// capture: true,
|
||||
// });
|
||||
|
||||
return () => {
|
||||
buttonRef.current?.removeEventListener("mousedown", onMouseDown, {
|
||||
capture: true,
|
||||
});
|
||||
// buttonRef.current?.removeEventListener("touchmove", onTouchMove, {
|
||||
// capture: true,
|
||||
// });
|
||||
|
||||
// buttonRef.current?.removeEventListener("touchend", onTouchEnd, {
|
||||
// capture: true,
|
||||
// });
|
||||
|
||||
// buttonRef.current?.removeEventListener("touchstart", onTouchStart, {
|
||||
// capture: true,
|
||||
// });
|
||||
};
|
||||
}, [buttonRef.current]);
|
||||
}, []);
|
||||
|
||||
const onMouseDown = useCallback((e: MouseEvent) => {
|
||||
console.log("Preventing");
|
||||
e.preventDefault();
|
||||
}, []);
|
||||
|
||||
@@ -30,6 +55,7 @@ export function Button(props: ButtonProps) {
|
||||
// e.preventDefault();
|
||||
// const now = Date.now();
|
||||
// setTimeout(() => {
|
||||
// console.log(now, touchStartTime.current);
|
||||
// if (touchStartTime.current === 0) return;
|
||||
// if (now - touchStartTime.current > 300) return;
|
||||
// //@ts-ignore
|
||||
@@ -39,9 +65,15 @@ export function Button(props: ButtonProps) {
|
||||
|
||||
// const onTouchStart = useCallback((e) => {
|
||||
// touchStartTime.current = Date.now();
|
||||
// console.log("HELLO!");
|
||||
// e.preventDefault();
|
||||
// }, []);
|
||||
|
||||
// const onTouchMove = useCallback((e) => {
|
||||
// console.log("HELLO!");
|
||||
// touchStartTime.current = 0;
|
||||
// }, []);
|
||||
|
||||
return (
|
||||
<RebassButton
|
||||
{...props}
|
||||
|
||||
@@ -35,7 +35,6 @@ export class PopupRenderer extends React.Component<
|
||||
this.setState((prev) => {
|
||||
const index = prev.popups.findIndex((p) => p.id === id);
|
||||
if (index <= -1) return prev;
|
||||
console.log(index, id, prev.popups[index]);
|
||||
const clone = prev.popups.slice();
|
||||
clone.splice(index, 1);
|
||||
return {
|
||||
@@ -50,7 +49,6 @@ export class PopupRenderer extends React.Component<
|
||||
{this.props.children}
|
||||
<EditorContext.Provider value={this.props.editor}>
|
||||
{this.state.popups.map(({ id, popup: Popup }) => {
|
||||
console.log(id, Popup);
|
||||
return <Popup key={id} />;
|
||||
})}
|
||||
<div id="popup-container" />
|
||||
|
||||
@@ -25,7 +25,6 @@ export function MoreTools(props: MoreToolsProps) {
|
||||
{...props}
|
||||
toggled={isOpen}
|
||||
buttonRef={buttonRef}
|
||||
onMouseDown={(e) => e.preventDefault()}
|
||||
onClick={() => setIsOpen((s) => !s)}
|
||||
/>
|
||||
<PopupWrapper
|
||||
@@ -50,12 +49,6 @@ export function MoreTools(props: MoreToolsProps) {
|
||||
sx={{
|
||||
flex: 1,
|
||||
p: 1,
|
||||
// TODO: we cannot put a fix height here
|
||||
// since it differs from platform to platform.
|
||||
// perhaps we can use a expose a custom css class
|
||||
// or extend the theme.
|
||||
// px: isBottom ? 0 : 1,
|
||||
// height: "50px",
|
||||
boxShadow: "menu",
|
||||
bg: "background",
|
||||
borderRadius: "default",
|
||||
|
||||
Reference in New Issue
Block a user