• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geosolutions-it / MapStore2 / 12831531306

17 Jan 2025 03:01PM UTC coverage: 77.182% (+0.07%) from 77.115%
12831531306

Pull #10746

github

web-flow
Merge 501dbaeea into 4e4dabc03
Pull Request #10746: Fix #10739 Changing correctly resolutions limits when switching map CRS

30373 of 47156 branches covered (64.41%)

34 of 43 new or added lines in 2 files covered. (79.07%)

126 existing lines in 15 files now uncovered.

37769 of 48935 relevant lines covered (77.18%)

35.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

40.0
/web/client/components/widgets/builder/wizard/text/TextOptions.jsx
1
/*
2
 * Copyright 2018, GeoSolutions Sas.
3
 * All rights reserved.
4
 *
5
 * This source code is licensed under the BSD-style license found in the
6
 * LICENSE file in the root directory of this source tree.
7
 */
8

9
import React, { useState } from "react";
10
import { Col, Form, FormControl, FormGroup } from "react-bootstrap";
11
import localizedProps from "../../../../misc/enhancers/localizedProps";
12
import {
13
    htmlToDraftJSEditorState,
14
    draftJSEditorStateToHtml
15
} from "../../../../../utils/EditorUtils";
16

17
import withDebounceOnCallback from "../../../../misc/enhancers/withDebounceOnCallback";
18
import CompactRichTextEditor from "../../../../mapviews/settings/CompactRichTextEditor";
19

20
const TitleInput = localizedProps("placeholder")(FormControl);
1✔
21
const DescriptorEditor = withDebounceOnCallback(
1✔
22
    "onEditorStateChange",
23
    "editorState"
24
)(CompactRichTextEditor);
25

26
function TextOptions({ data = {}, onChange = () => {} }) {
1!
27
    const [editorState, setEditorState] = useState(
1✔
28
        htmlToDraftJSEditorState(data.text || "")
2✔
29
    );
30

31
    return (
1✔
32
        <div>
33
            <Col key="form" xs={12}>
34
                <Form>
35
                    <FormGroup controlId="title">
36
                        <Col sm={12}>
37
                            <TitleInput
38
                                style={{ marginBottom: 10 }}
39
                                placeholder="widgets.builder.wizard.titlePlaceholder"
40
                                value={data.title}
41
                                type="text"
42
                                onChange={(e) =>
43
                                    onChange("title", e.target.value)
×
44
                                }
45
                            />
46
                        </Col>
47
                    </FormGroup>
48
                </Form>
49
            </Col>
50
            <DescriptorEditor
51
                uploadEnabled
52
                editorState={editorState}
53
                onEditorStateChange={(newEditorState) => {
54
                    const previousHTML = draftJSEditorStateToHtml(editorState);
×
55
                    const newHTML = draftJSEditorStateToHtml(newEditorState);
×
56
                    if (newHTML !== previousHTML) {
×
UNCOV
57
                        onChange(
×
58
                            "text",
59
                            draftJSEditorStateToHtml(newEditorState)
60
                        );
UNCOV
61
                        setEditorState(newEditorState);
×
62
                    }
63
                }}
64
                // Array of custom or built in fonts can be set via props
65
                // fonts={["Arial", "Impact", "Roman"]}
66
            />
67
        </div>
68
    );
69
}
70
export default TextOptions;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc