Skip to content

Commit c29d767

Browse files
Merge pull request #81 from gisce/markdown_widget
Add Markdown widget
2 parents addc217 + 6268f2b commit c29d767

File tree

6 files changed

+28
-3
lines changed

6 files changed

+28
-3
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gisce/ooui",
3-
"version": "0.19.2",
3+
"version": "0.19.3",
44
"main": "./dist/ooui.umd.js",
55
"module": "./dist/ooui.es.js",
66
"types": "./dist/index.d.ts",

src/Markdown.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Text from "./Text";
2+
3+
class Markdown extends Text {}
4+
5+
6+
export default Markdown;

src/WidgetFactory.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Char from "./Char";
88
import Text from "./Text";
99
import Selection from "./Selection";
1010
import Many2one from "./Many2one";
11+
import Markdown from "./Markdown";
1112
import Boolean from "./Boolean";
1213
import Integer from "./Integer";
1314
import Widget from "./Widget";
@@ -96,6 +97,9 @@ class WidgetFactory {
9697
case "many2many":
9798
this._widgetClass = Many2many;
9899
break;
100+
case "markdown":
101+
this._widgetClass = Markdown;
102+
break;
99103
case "one2many":
100104
case "one2many_list":
101105
this._widgetClass = One2many;

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import ProgressBar from "./ProgressBar";
1616
import Date from "./Date";
1717
import DateTime from "./DateTime";
1818
import Many2many from "./Many2many";
19+
import Markdown from "./Markdown";
1920
import One2many from "./One2many";
2021
import SearchFilter from "./SearchFilter";
2122
import Text from "./Text";
@@ -112,6 +113,7 @@ export {
112113
Tags,
113114
Tag,
114115
MultiCheckbox,
116+
Markdown,
115117
Radio,
116118
Switch,
117119
Steps,

src/spec/Markdown.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import WidgetFactory from "../WidgetFactory";
2+
3+
describe("A Markdown widget", () => {
4+
it("should have an id corresponding to field name", () => {
5+
const widgetFactory = new WidgetFactory();
6+
const props = {
7+
name: "status",
8+
};
9+
10+
const widget = widgetFactory.createWidget("markdown", props);
11+
expect(widget.id).toBe("status");
12+
});
13+
});

0 commit comments

Comments
 (0)