@cocreate/text 1.20.29 → 1.21.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +19 -0
- package/CoCreate.config.js +2 -2
- package/LICENSE +177 -178
- package/demo/custom-rich-text.html +15 -15
- package/demo/demos.1.html +4 -4
- package/demo/demos.html +11 -11
- package/demo/index.html +22 -22
- package/demo/test-webpage.html +17 -17
- package/docs/index.html +19 -19
- package/package.json +10 -11
- package/src/index.js +53 -50
- package/src/updateText.js +43 -43
- package/webpack.config.js +77 -73
- package/src/saveDomText.js +0 -32
@@ -6,22 +6,22 @@
|
|
6
6
|
var oDoc, sDefTxt;
|
7
7
|
|
8
8
|
function initDoc() {
|
9
|
-
oDoc =
|
9
|
+
oDoc = object.getElementById("textBox");
|
10
10
|
sDefTxt = oDoc.innerHTML;
|
11
|
-
if (
|
11
|
+
if (object.compForm.switchMode.checked) {
|
12
12
|
setDocMode(true);
|
13
13
|
}
|
14
14
|
}
|
15
15
|
|
16
16
|
function formatDoc(sCmd, sValue) {
|
17
17
|
if (validateMode()) {
|
18
|
-
|
18
|
+
object.execCommand(sCmd, false, sValue);
|
19
19
|
oDoc.focus();
|
20
20
|
}
|
21
21
|
}
|
22
22
|
|
23
23
|
function validateMode() {
|
24
|
-
if (!
|
24
|
+
if (!object.compForm.switchMode.checked) {
|
25
25
|
return true;
|
26
26
|
}
|
27
27
|
alert('Uncheck "Show HTML".');
|
@@ -32,24 +32,24 @@
|
|
32
32
|
function setDocMode(bToSource) {
|
33
33
|
var oContent;
|
34
34
|
if (bToSource) {
|
35
|
-
oContent =
|
35
|
+
oContent = object.createTextNode(oDoc.innerHTML);
|
36
36
|
oDoc.innerHTML = "";
|
37
|
-
var oPre =
|
37
|
+
var oPre = object.createElement("pre");
|
38
38
|
oDoc.contentEditable = false;
|
39
39
|
oPre.id = "sourceText";
|
40
40
|
oPre.contentEditable = true;
|
41
41
|
oPre.appendChild(oContent);
|
42
42
|
oDoc.appendChild(oPre);
|
43
|
-
|
43
|
+
object.execCommand(
|
44
44
|
"defaultParagraphSeparator",
|
45
45
|
false,
|
46
46
|
"div"
|
47
47
|
);
|
48
48
|
} else {
|
49
|
-
if (
|
49
|
+
if (object.all) {
|
50
50
|
oDoc.innerHTML = oDoc.innerText;
|
51
51
|
} else {
|
52
|
-
oContent =
|
52
|
+
oContent = object.createRange();
|
53
53
|
oContent.selectNodeContents(oDoc.firstChild);
|
54
54
|
oDoc.innerHTML = oContent.toString();
|
55
55
|
}
|
@@ -67,13 +67,13 @@
|
|
67
67
|
"_blank",
|
68
68
|
"width=450,height=470,left=400,top=100,menubar=yes,toolbar=no,location=no,scrollbars=yes"
|
69
69
|
);
|
70
|
-
oPrntWin.
|
71
|
-
oPrntWin.
|
70
|
+
oPrntWin.object.open();
|
71
|
+
oPrntWin.object.write(`
|
72
72
|
<!doctype html><html><head><title>Print<\/title><\/head><body onload="print();">' +
|
73
73
|
oDoc.innerHTML +
|
74
74
|
"<\/body><\/html>"
|
75
75
|
`);
|
76
|
-
oPrntWin.
|
76
|
+
oPrntWin.object.close();
|
77
77
|
}
|
78
78
|
</script>
|
79
79
|
<style type="text/css">
|
@@ -107,11 +107,11 @@
|
|
107
107
|
</head>
|
108
108
|
<body onload="initDoc();">
|
109
109
|
<form
|
110
|
-
|
110
|
+
key="compForm"
|
111
111
|
method="post"
|
112
112
|
action="sample.php"
|
113
113
|
onsubmit="if (validateMode()){this.myDoc.value=oDoc.innerHTML;return true;}return false;">
|
114
|
-
<input type="hidden"
|
114
|
+
<input type="hidden" key="myDoc" />
|
115
115
|
<div id="toolBar1">
|
116
116
|
<select
|
117
117
|
onchange="formatDoc('formatblock',this[this.selectedIndex].value);this.selectedIndex=0;">
|
@@ -266,7 +266,7 @@
|
|
266
266
|
<p id="editMode">
|
267
267
|
<input
|
268
268
|
type="checkbox"
|
269
|
-
|
269
|
+
key="switchMode"
|
270
270
|
id="switchBox"
|
271
271
|
onchange="setDocMode(this.checked);" />
|
272
272
|
<label for="switchBox">Show HTML</label>
|
package/demo/demos.1.html
CHANGED
@@ -9,13 +9,13 @@
|
|
9
9
|
</head>
|
10
10
|
|
11
11
|
<body class="padding:20px">
|
12
|
-
<form
|
12
|
+
<form array="apples1" object="">
|
13
13
|
<textarea
|
14
|
-
|
14
|
+
key="name1"
|
15
15
|
class="width:100% padding:0px margin:0px"
|
16
16
|
rows="10"></textarea>
|
17
|
-
<textarea
|
18
|
-
<iframe
|
17
|
+
<textarea key="name2" class="width:100%" rows="10"></textarea>
|
18
|
+
<iframe key="name2" width="100%" contenteditable></iframe>
|
19
19
|
</form>
|
20
20
|
|
21
21
|
<!--<script src="../dist/CoCreate-text.js" ></script>-->
|
package/demo/demos.html
CHANGED
@@ -9,25 +9,25 @@
|
|
9
9
|
</head>
|
10
10
|
|
11
11
|
<body class="padding:20px">
|
12
|
-
<form
|
13
|
-
<input type="email"
|
14
|
-
<input type="tel"
|
15
|
-
<input type="url"
|
16
|
-
<h1
|
17
|
-
<!-- <textarea
|
18
|
-
<!--<h1
|
19
|
-
<!-- <div
|
12
|
+
<form array="test" object="62a3f5d5e6dfc91d581cdd2d">
|
13
|
+
<input type="email" key="email" />
|
14
|
+
<input type="tel" key="tel" />
|
15
|
+
<input type="url" key="url" />
|
16
|
+
<h1 key="name" array="test"></h1>
|
17
|
+
<!-- <textarea key="name2"></textarea> -->
|
18
|
+
<!--<h1 key='name' contenteditable>I will be replaced by crdt</h1>-->
|
19
|
+
<!-- <div key='name2' contenteditable>I will be replaced by crud</div> -->
|
20
20
|
|
21
21
|
<div class="padding:20px">
|
22
|
-
CoCreateCrdt.init({
|
22
|
+
CoCreateCrdt.init({array: "apples1", object:
|
23
23
|
"60bea334b25613e8da1b4bdf", name: "src"});
|
24
24
|
</div>
|
25
25
|
<div class="padding:20px">
|
26
|
-
CoCreateCrdt.getText({
|
26
|
+
CoCreateCrdt.getText({array: "apples1", object:
|
27
27
|
"60bea334b25613e8da1b4bdf", name: "src"});
|
28
28
|
</div>
|
29
29
|
<div class="padding:20px">
|
30
|
-
CoCreate.crdt.getText({
|
30
|
+
CoCreate.crdt.getText({array: "apples1", object:
|
31
31
|
"5fe9e0a11b4a703e71c51ba8", name: "name"});
|
32
32
|
</div>
|
33
33
|
</form>
|
package/demo/index.html
CHANGED
@@ -16,54 +16,54 @@
|
|
16
16
|
|
17
17
|
<body>
|
18
18
|
<div class="padding:20px">
|
19
|
-
<!--<input
|
20
|
-
<!--<textarea
|
21
|
-
<!--<textarea
|
19
|
+
<!--<input array="modules" realtime="true" object="5e6d06ab430580425dd9e950" key="inputText" style="width: 500px; display: block">-->
|
20
|
+
<!--<textarea array="modules" realtime="true" object="5e6d06ab430580425dd9e950" key="nameOtro" id="textare_test" rows="10" style="width: 500px; display: block" ></textarea>-->
|
21
|
+
<!--<textarea array="modules" realtime="true" object="5e6d06ab430580425dd9e950" key="nameOtro2" id="textare_test" rows="10" style="width: 500px; display: block" ></textarea>-->
|
22
22
|
<form
|
23
23
|
realtime="true"
|
24
|
-
|
24
|
+
array="module_activities"
|
25
25
|
class="margin-bottom:75px"
|
26
26
|
id="form">
|
27
27
|
<input
|
28
28
|
type="number"
|
29
|
-
|
29
|
+
array="module_activities"
|
30
30
|
realtime="true"
|
31
|
-
|
32
|
-
|
31
|
+
object="5ef50326e0219c2a488dc6bc"
|
32
|
+
key="inputText"
|
33
33
|
style="width: 100%; display: block" />
|
34
34
|
<input
|
35
35
|
type="date"
|
36
|
-
|
36
|
+
array="module_activities"
|
37
37
|
realtime="true"
|
38
|
-
|
39
|
-
|
38
|
+
object="5ef50326e0219c2a488dc6bc"
|
39
|
+
key="inputdate"
|
40
40
|
style="width: 100%; display: block" />
|
41
41
|
<textarea
|
42
42
|
realtime="true"
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
array="module_activities"
|
44
|
+
object="5ef50326e0219c2a488dc6bc"
|
45
|
+
key="nameOtro"
|
46
46
|
rows="10"
|
47
47
|
class="floating-label"></textarea>
|
48
48
|
<textarea
|
49
49
|
realtime="true"
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
array="module_activities"
|
51
|
+
object="5ef50326e0219c2a488dc6bc"
|
52
|
+
key="html"
|
53
53
|
rows="10"
|
54
54
|
class="floating-label"></textarea>
|
55
55
|
<textarea
|
56
|
-
|
56
|
+
array="module_activities"
|
57
57
|
realtime="true"
|
58
|
-
|
59
|
-
|
58
|
+
object=""
|
59
|
+
key="nameOtro123"
|
60
60
|
rows="10"
|
61
61
|
style="width: 100%; display: block"></textarea>
|
62
62
|
<input
|
63
|
-
|
63
|
+
array="modules"
|
64
64
|
realtime="true"
|
65
|
-
|
66
|
-
|
65
|
+
object="5ef50326e0219c2a488dc6bc"
|
66
|
+
key="text"
|
67
67
|
style="width: 500px; display: block" />
|
68
68
|
</form>
|
69
69
|
</div>
|
package/demo/test-webpage.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
7
7
|
<title>CoCreateJS - A Low-code Javascript framework</title>
|
8
8
|
<meta
|
9
|
-
|
9
|
+
key="description"
|
10
10
|
content="A Low-code JavaScript framework for building collaborative No-code platforms, apps and UI" />
|
11
11
|
<link rel="icon" sizes="32x32" href="assets/favicon.ico" />
|
12
12
|
<meta name="robots" content="index,follow" />
|
@@ -23,9 +23,9 @@
|
|
23
23
|
rel="stylesheet"
|
24
24
|
href="/index.css"
|
25
25
|
type="text/css"
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
array="files"
|
27
|
+
object="6092da6b19ec8e58fc80c94e"
|
28
|
+
key="src"
|
29
29
|
save="true"
|
30
30
|
parse="true"
|
31
31
|
minified />
|
@@ -58,9 +58,9 @@
|
|
58
58
|
<body>
|
59
59
|
<div
|
60
60
|
contenteditable
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
array="test"
|
62
|
+
object="60c7d9d08692d10f1c183d0f"
|
63
|
+
key="html"
|
64
64
|
class="sortabl">
|
65
65
|
<!-- Navbar -->
|
66
66
|
<nav
|
@@ -68,17 +68,17 @@
|
|
68
68
|
scroll="sticky-nav,hide-nav"
|
69
69
|
scroll-up="10"
|
70
70
|
scroll-down="10"
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
array="components"
|
72
|
+
object="6091b71857a0e06b6d572d5c"
|
73
|
+
key="html"></nav>
|
74
74
|
|
75
75
|
<!-- SideNav Left-->
|
76
76
|
<sidenav
|
77
77
|
id="menuL"
|
78
78
|
class="cocreate-sidenav background:whitesmoke display:none"
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
array="components"
|
80
|
+
object="6090c58598c42a332d21807f"
|
81
|
+
key="html"
|
82
82
|
content_id="content"
|
83
83
|
sidenav-default_desktop="offcanvas"
|
84
84
|
sidenav-default_tablet="offcanvas"
|
@@ -98,7 +98,7 @@
|
|
98
98
|
<main class="width:auto" content_id="content">
|
99
99
|
<section
|
100
100
|
class="padding-top:80px padding-bottom:40px"
|
101
|
-
|
101
|
+
classkey="test">
|
102
102
|
<div class="max-width:90% margin:0px_auto">
|
103
103
|
<div
|
104
104
|
class="display:flex flex-wrap:wrap align-items:center flex-direction:row-reverse">
|
@@ -365,9 +365,9 @@
|
|
365
365
|
content_id="content"
|
366
366
|
class="padding:100px_0px background-size:cover background-position:center position:relative color:white"
|
367
367
|
style="background-image: url(/assets/banner.png)"
|
368
|
-
|
369
|
-
|
370
|
-
|
368
|
+
array="components"
|
369
|
+
object="6092ebcc19ec8e58fc80c9e3"
|
370
|
+
key="html"></footer>
|
371
371
|
</div>
|
372
372
|
|
373
373
|
<!--CoCreateJS-->
|
package/docs/index.html
CHANGED
@@ -11,10 +11,10 @@
|
|
11
11
|
sizes="32x32"
|
12
12
|
href="https://cocreate.app/images/favicon.ico" />
|
13
13
|
<meta
|
14
|
-
|
14
|
+
key="description"
|
15
15
|
content="A simple HTML5 and pure javascript component. Easy configuration using HTML5 attributes or Javscript api and highly styleable." />
|
16
16
|
<meta
|
17
|
-
|
17
|
+
key="keywords"
|
18
18
|
content="helper classes, utility classes, css framework, css library, inline style classes" />
|
19
19
|
<meta name="robots" content="index,follow" />
|
20
20
|
<meta
|
@@ -23,9 +23,9 @@
|
|
23
23
|
<link
|
24
24
|
rel="stylesheet"
|
25
25
|
href="/docs/index.css"
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
array="files"
|
27
|
+
object="60888216117c640e7596303f"
|
28
|
+
key="src"
|
29
29
|
type="text/css"
|
30
30
|
save="true" />
|
31
31
|
<link rel="manifest" href="/manifest.webmanifest" />
|
@@ -38,20 +38,20 @@
|
|
38
38
|
scroll="sticky-nav,hide-nav"
|
39
39
|
scroll-up="10"
|
40
40
|
scroll-down="10"
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
array="files"
|
42
|
+
object="60395ef42b3ac232657040fd"
|
43
|
+
key="src"></nav>
|
44
44
|
<sidenav
|
45
45
|
id="menuL"
|
46
46
|
class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl"
|
47
47
|
resizable
|
48
|
-
resize-
|
48
|
+
resize-selector="[content_id='content']"
|
49
49
|
resize-property="margin-left"
|
50
50
|
resize-value="width">
|
51
51
|
<menu
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
array="files"
|
53
|
+
object="603717b07de7fb350ae9fec8"
|
54
|
+
key="src"></menu>
|
55
55
|
<div resize="right"></div>
|
56
56
|
</sidenav>
|
57
57
|
<main
|
@@ -194,12 +194,12 @@
|
|
194
194
|
<textarea
|
195
195
|
type="code"
|
196
196
|
lang="html"
|
197
|
-
|
198
|
-
|
199
|
-
|
197
|
+
array="demos"
|
198
|
+
object=""
|
199
|
+
key="demo"
|
200
200
|
save="false"
|
201
201
|
id="demo"
|
202
|
-
input-
|
202
|
+
input-selector=".demopreview"
|
203
203
|
input-attribute="value"
|
204
204
|
input-events="input, onload"
|
205
205
|
class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
|
@@ -222,7 +222,7 @@
|
|
222
222
|
show="#eye-slash"
|
223
223
|
hide="#eye, #demo-preview"
|
224
224
|
toggle="code-height"
|
225
|
-
toggle-
|
225
|
+
toggle-selector="#demo-code"
|
226
226
|
><i
|
227
227
|
class="height:18px fill:#505050"
|
228
228
|
src="/assets/svg/eye.svg"></i
|
@@ -234,7 +234,7 @@
|
|
234
234
|
show="#eye, #demo-preview"
|
235
235
|
hide="#eye-slash"
|
236
236
|
toggle="code-height"
|
237
|
-
toggle-
|
237
|
+
toggle-selector="#demo-code"
|
238
238
|
><i
|
239
239
|
class="height:20px fill:#505050"
|
240
240
|
src="/assets/svg/eye-slash.svg"></i
|
@@ -261,7 +261,7 @@
|
|
261
261
|
<a
|
262
262
|
class="margin-right:5px"
|
263
263
|
fullscreen
|
264
|
-
fullscreen-
|
264
|
+
fullscreen-selector="#playground"></a>
|
265
265
|
</div>
|
266
266
|
</div>
|
267
267
|
<!-- End SandBox -->
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@cocreate/text",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.21.0",
|
4
4
|
"description": "A simple text component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
|
5
5
|
"keywords": [
|
6
6
|
"text",
|
@@ -25,7 +25,7 @@
|
|
25
25
|
},
|
26
26
|
"scripts": {
|
27
27
|
"start": "npx webpack --config webpack.config.js",
|
28
|
-
"build": "
|
28
|
+
"build": "npx webpack --mode=production --config webpack.config.js",
|
29
29
|
"dev": "npx webpack --config webpack.config.js --watch",
|
30
30
|
"postinstall": "node -e \"const { execSync } = require('child_process'); try { execSync('coc --version', { stdio: 'ignore' }); } catch (error) { try { execSync('npm install -g @cocreate/cli', { stdio: 'inherit' }); console.log('Installed \"@cocreate/cli\" globally.'); } catch (error) { console.error('Failed to install \"@cocreate/cli\" globally:', error); } }\""
|
31
31
|
},
|
@@ -34,7 +34,7 @@
|
|
34
34
|
"url": "git+https://github.com/CoCreate-app/CoCreate-text.git"
|
35
35
|
},
|
36
36
|
"author": "CoCreate LLC",
|
37
|
-
"license": "
|
37
|
+
"license": "AGPL-3.0",
|
38
38
|
"bugs": {
|
39
39
|
"url": "https://github.com/CoCreate-app/CoCreate-text/issues"
|
40
40
|
},
|
@@ -58,13 +58,12 @@
|
|
58
58
|
"webpack-log": "^3.0.1"
|
59
59
|
},
|
60
60
|
"dependencies": {
|
61
|
-
"@cocreate/actions": "^1.8.
|
62
|
-
"@cocreate/crdt": "^1.18.
|
63
|
-
"@cocreate/
|
64
|
-
"@cocreate/
|
65
|
-
"@cocreate/
|
66
|
-
"@cocreate/
|
67
|
-
"@cocreate/
|
68
|
-
"@cocreate/uuid": "^1.4.27"
|
61
|
+
"@cocreate/actions": "^1.8.32",
|
62
|
+
"@cocreate/crdt": "^1.18.28",
|
63
|
+
"@cocreate/cursors": "^1.16.29",
|
64
|
+
"@cocreate/observer": "^1.8.19",
|
65
|
+
"@cocreate/selection": "^1.6.28",
|
66
|
+
"@cocreate/utils": "^1.21.16",
|
67
|
+
"@cocreate/uuid": "^1.4.28"
|
69
68
|
}
|
70
69
|
}
|