blixify-ui-web 0.1.298 → 0.1.299
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.
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import "@mdxeditor/editor/style.css";
|
|
1
2
|
import React, { Component, ReactElement } from "react";
|
|
2
3
|
import "../../../index.css";
|
|
3
|
-
import { Command } from "./utils";
|
|
4
4
|
interface Props {
|
|
5
5
|
id?: string;
|
|
6
|
+
ref?: any;
|
|
6
7
|
value: string;
|
|
7
8
|
label: string;
|
|
8
9
|
subLabel?: string;
|
|
@@ -11,16 +12,17 @@ interface Props {
|
|
|
11
12
|
optional?: boolean;
|
|
12
13
|
disabled?: boolean;
|
|
13
14
|
containerClassName?: string;
|
|
14
|
-
excludeCommands?: Command[];
|
|
15
|
-
visibleDragbar?: boolean;
|
|
16
15
|
onChange: (id: string, value?: string) => void;
|
|
17
16
|
darkMode?: boolean;
|
|
17
|
+
readOnly?: boolean;
|
|
18
18
|
}
|
|
19
19
|
interface State {
|
|
20
20
|
error: String;
|
|
21
|
+
mdxEditor: any;
|
|
21
22
|
}
|
|
22
23
|
export declare class MarkdownInput extends Component<Props> {
|
|
23
24
|
state: State;
|
|
25
|
+
componentDidMount: () => Promise<void>;
|
|
24
26
|
setAsyncState: (newState: any) => Promise<unknown>;
|
|
25
27
|
handleOnChange: (value?: string) => void;
|
|
26
28
|
handleSubmit: () => Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/input/markdown/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/input/markdown/index.tsx"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,oBAAoB,CAAC;AAE5B,UAAU,KAAK;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAE/C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,GAAG,CAAC;CAChB;AAED,qBAAa,aAAc,SAAQ,SAAS,CAAC,KAAK,CAAC;IACjD,KAAK,EAAE,KAAK,CAAkC;IAE9C,iBAAiB,sBAKf;IAEF,aAAa,sCACqD;IAElE,cAAc,WAAY,MAAM,UAE9B;IAEF,YAAY,yBAmBV;IAEF,MAAM;CA8FP"}
|
|
@@ -73,20 +73,30 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
73
73
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
77
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
78
|
-
};
|
|
79
76
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
80
77
|
exports.MarkdownInput = void 0;
|
|
81
|
-
|
|
78
|
+
require("@mdxeditor/editor/style.css");
|
|
82
79
|
var react_1 = __importStar(require("react"));
|
|
83
|
-
var rehype_sanitize_1 = __importDefault(require("rehype-sanitize"));
|
|
84
80
|
require("../../../index.css");
|
|
85
81
|
var MarkdownInput = /** @class */ (function (_super) {
|
|
86
82
|
__extends(MarkdownInput, _super);
|
|
87
83
|
function MarkdownInput() {
|
|
88
84
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
89
|
-
_this.state = { error: "" };
|
|
85
|
+
_this.state = { error: "", mdxEditor: null };
|
|
86
|
+
_this.componentDidMount = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
87
|
+
var mdxEditor;
|
|
88
|
+
return __generator(this, function (_a) {
|
|
89
|
+
switch (_a.label) {
|
|
90
|
+
case 0: return [4 /*yield*/, require("@mdxeditor/editor")];
|
|
91
|
+
case 1:
|
|
92
|
+
mdxEditor = _a.sent();
|
|
93
|
+
this.setState({
|
|
94
|
+
mdxEditor: mdxEditor,
|
|
95
|
+
});
|
|
96
|
+
return [2 /*return*/];
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}); };
|
|
90
100
|
_this.setAsyncState = function (newState) {
|
|
91
101
|
return new Promise(function (resolve) { return _this.setState(newState, resolve); });
|
|
92
102
|
};
|
|
@@ -125,6 +135,8 @@ var MarkdownInput = /** @class */ (function (_super) {
|
|
|
125
135
|
return _this;
|
|
126
136
|
}
|
|
127
137
|
MarkdownInput.prototype.render = function () {
|
|
138
|
+
var _a;
|
|
139
|
+
var MDXEditor = this.state.mdxEditor;
|
|
128
140
|
var labelColor = this.props.darkMode ? "text-white" : "text-gray-700";
|
|
129
141
|
var subColor = this.props.darkMode ? "text-gray-300" : "text-gray-500";
|
|
130
142
|
var defaultClassName = "";
|
|
@@ -133,21 +145,45 @@ var MarkdownInput = /** @class */ (function (_super) {
|
|
|
133
145
|
if (this.props.disabled) {
|
|
134
146
|
defaultClassName += "pointer-events-none opacity-60";
|
|
135
147
|
}
|
|
136
|
-
var
|
|
137
|
-
if (
|
|
138
|
-
|
|
148
|
+
var plugins = [];
|
|
149
|
+
if (MDXEditor) {
|
|
150
|
+
plugins.push(MDXEditor.headingsPlugin(), MDXEditor.listsPlugin(), MDXEditor.quotePlugin(), MDXEditor.thematicBreakPlugin(), MDXEditor.tablePlugin()
|
|
151
|
+
// imagePlugin({
|
|
152
|
+
// imageUploadHandler: async (image) => {
|
|
153
|
+
// const url = await Promise.resolve(
|
|
154
|
+
// this.props.imageUploadHandler?.(image)
|
|
155
|
+
// );
|
|
156
|
+
// if (!url) {
|
|
157
|
+
// throw new Error("Image upload failed");
|
|
158
|
+
// }
|
|
159
|
+
// return url;
|
|
160
|
+
// },
|
|
161
|
+
// }),
|
|
162
|
+
);
|
|
163
|
+
if (!this.props.readOnly)
|
|
164
|
+
plugins.push(MDXEditor.toolbarPlugin({
|
|
165
|
+
toolbarContents: function () {
|
|
166
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
167
|
+
react_1.default.createElement(MDXEditor.UndoRedo, null),
|
|
168
|
+
react_1.default.createElement(MDXEditor.BoldItalicUnderlineToggles, null),
|
|
169
|
+
react_1.default.createElement(MDXEditor.StrikeThroughSupSubToggles, null),
|
|
170
|
+
react_1.default.createElement(MDXEditor.ListsToggle, null),
|
|
171
|
+
react_1.default.createElement(MDXEditor.BlockTypeSelect, null),
|
|
172
|
+
react_1.default.createElement(MDXEditor.InsertThematicBreak, null),
|
|
173
|
+
react_1.default.createElement(MDXEditor.InsertTable, null)));
|
|
174
|
+
},
|
|
175
|
+
}));
|
|
139
176
|
}
|
|
140
177
|
return (react_1.default.createElement("div", { className: defaultClassName },
|
|
141
|
-
react_1.default.createElement(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
} }),
|
|
178
|
+
!this.props.readOnly && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
179
|
+
react_1.default.createElement("label", { className: "block text-sm font-medium ".concat(labelColor) },
|
|
180
|
+
this.props.label,
|
|
181
|
+
" ",
|
|
182
|
+
this.props.labelExtra),
|
|
183
|
+
this.props.subLabel && (react_1.default.createElement("label", { className: "block text-xs font-medium ".concat(subColor, " mb-2") }, this.props.subLabel)))),
|
|
184
|
+
react_1.default.createElement("div", { id: this.props.id }, (MDXEditor === null || MDXEditor === void 0 ? void 0 : MDXEditor.MDXEditor) && (react_1.default.createElement(MDXEditor.MDXEditor, { ref: this.props.ref, className: "".concat(this.state.error.length > 0 && "w-md-editor-error", " mt-2 rounded ").concat(this.props.darkMode
|
|
185
|
+
? "dark-theme dark-editor bg-gray-700"
|
|
186
|
+
: !this.props.readOnly && "border border-gray-300"), contentEditableClassName: "prose prose-sm md:prose-base overflow-y-auto h-44 max-w-none ".concat(this.props.darkMode ? "dark:prose-invert" : ""), markdown: this.props.value, onChange: this.handleOnChange, placeholder: !this.props.readOnly && this.props.placeholder, plugins: plugins, readOnly: (_a = this.props.readOnly) !== null && _a !== void 0 ? _a : false }))),
|
|
151
187
|
this.state.error && (react_1.default.createElement("span", { className: "text-red-500 text-sm" }, this.state.error))));
|
|
152
188
|
};
|
|
153
189
|
return MarkdownInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/input/markdown/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/input/markdown/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAqC;AACrC,6CAAuD;AACvD,8BAA4B;AAwB5B;IAAmC,iCAAgB;IAAnD;QAAA,qEAoIC;QAnIC,WAAK,GAAU,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAE9C,uBAAiB,GAAG;;;;4BACA,qBAAM,OAAO,CAAC,mBAAmB,CAAC,EAAA;;wBAA9C,SAAS,GAAG,SAAkC;wBACp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ACL,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,CACnB,wCAAM,SAAS,EAAC,sBAAsB,IAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAQ,CACjE,CACG,CACP,CAAC;IACJ,CAAC;IACH,oBAAC;AAAD,CAAC,AApID,CAAmC,iBAAS,GAoI3C;AApIY,sCAAa"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blixify-ui-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.299",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -109,7 +109,9 @@
|
|
|
109
109
|
"@fullcalendar/list": "^6.1.11",
|
|
110
110
|
"@fullcalendar/react": "^6.1.11",
|
|
111
111
|
"@fullcalendar/timegrid": "^6.1.11",
|
|
112
|
+
"@mdxeditor/editor": "^3.7.0",
|
|
112
113
|
"@tailwindcss/forms": "^0.5.3",
|
|
114
|
+
"@tailwindcss/typography": "^0.5.13",
|
|
113
115
|
"@uiw/react-md-editor": "^4.0.2",
|
|
114
116
|
"apexcharts": "^3.36.3",
|
|
115
117
|
"idb": "^8.0.0",
|