@softwarity/geojson-editor 1.0.9 → 1.0.11
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.
- package/README.md +9 -63
- package/dist/geojson-editor.js +2 -2
- package/package.json +2 -1
- package/src/geojson-editor.css +453 -0
- package/src/geojson-editor.js +2152 -2086
- package/src/geojson-editor.template.js +57 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML Template for GeoJSON Editor
|
|
3
|
+
* @param {string} placeholder - Placeholder text
|
|
4
|
+
* @returns {string} HTML template string
|
|
5
|
+
*/
|
|
6
|
+
export function getTemplate(placeholder = '') {
|
|
7
|
+
return `
|
|
8
|
+
<div class="prefix-wrapper">
|
|
9
|
+
<div class="prefix-gutter"></div>
|
|
10
|
+
<div class="editor-prefix" id="editorPrefix"></div>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="editor-wrapper">
|
|
13
|
+
<div class="gutter">
|
|
14
|
+
<div class="gutter-scroll" id="gutterScroll">
|
|
15
|
+
<div class="gutter-scroll-content" id="gutterScrollContent">
|
|
16
|
+
<div class="gutter-content" id="gutterContent"></div>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="editor-content">
|
|
21
|
+
<div class="placeholder-layer" id="placeholderLayer">${escapeHtml(placeholder)}</div>
|
|
22
|
+
<textarea
|
|
23
|
+
class="hidden-textarea"
|
|
24
|
+
id="hiddenTextarea"
|
|
25
|
+
spellcheck="false"
|
|
26
|
+
autocomplete="off"
|
|
27
|
+
autocorrect="off"
|
|
28
|
+
autocapitalize="off"
|
|
29
|
+
tabindex="0"
|
|
30
|
+
></textarea>
|
|
31
|
+
<div class="viewport" id="viewport">
|
|
32
|
+
<div class="scroll-content" id="scrollContent">
|
|
33
|
+
<div class="lines-container" id="linesContainer"></div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
<div class="suffix-wrapper">
|
|
39
|
+
<div class="suffix-gutter"></div>
|
|
40
|
+
<div class="editor-suffix" id="editorSuffix"></div>
|
|
41
|
+
<button class="clear-btn" id="clearBtn" title="Clear editor">✕</button>
|
|
42
|
+
</div>
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Escape HTML special characters
|
|
48
|
+
* @param {string} text - Text to escape
|
|
49
|
+
* @returns {string} Escaped text
|
|
50
|
+
*/
|
|
51
|
+
function escapeHtml(text) {
|
|
52
|
+
if (!text) return '';
|
|
53
|
+
return text
|
|
54
|
+
.replace(/&/g, '&')
|
|
55
|
+
.replace(/</g, '<')
|
|
56
|
+
.replace(/>/g, '>');
|
|
57
|
+
}
|