Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
taufik-nurrohman committed Jun 2, 2024
1 parent cb5b533 commit c5ff807
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
20 changes: 10 additions & 10 deletions .factory/index.html.pug
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,21 @@ block content
= ' Methods'
h3 Instance Methods
p Instance methods are methods that are available through the results of a #[code TextEditor] construct.
h4: code editor.$()
p Get current text selection data.
pre: code
| // `a#[mark b]c`
| console.log(editor.$()); // `{"after":"c","before":"a","end":2,"length":1,"start":1,"value":"b"}`
h4: code editor.attach(self, state)
p Re-initialize the application and its extensions after it has been detached.
pre: code
| editor.attach(editor.self);
| editor.attach();
h4: code editor.blur()
p Blur from the #[code <textarea>] element.
h4: code editor.detach()
p Disable the application methods (except for the #[code attach()] method) and execute the #[code detach()] method of the extensions, if they are present.
pre: code
| editor.detach();
h4: code editor.fire(event, data)
p Fire an event.
pre: code
Expand All @@ -131,10 +140,6 @@ block content
| editor.focus(-1); // Focus to the start of text area value
| editor.focus(+1); // Focus to the end of text area value
| editor.focus(true); // Select all
h4: code editor.detach()
p Disable the application methods (except for the #[code attach()] method) and execute the #[code detach()] method of the extensions, if they are present.
pre: code
| editor.detach();
h4: code editor.get()
p Get current value of the #[code <textarea>] element if not empty, otherwise, return #[code null].
h4: code editor.insert(value, mode = 0, clear = false)
Expand Down Expand Up @@ -232,11 +237,6 @@ block content
pre: code
| editor.wrap('<', '>'); // Wrap with `<` and `>`
| editor.wrap('<', '>', true); // Wrap with `<` and `>` then select
h4: code editor.$()
p Get current text selection data.
pre: code
| // `a#[mark b]c`
| console.log(editor.$()); // `{"after":"c","before":"a","end":2,"length":1,"start":1,"value":"b"}`
h3 Static Methods
p Static methods are methods that are directly available on the #[code TextEditor] object.
h4: code TextEditor.esc(value)
Expand Down
2 changes: 1 addition & 1 deletion .factory/test/attach,detach.html.pug
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ block content
p
button(onclick='return editor.detach(), (this.disabled = true), (this.nextElementSibling.disabled = false), console.log(editor), false;') Detach
= ' '
button(disabled onclick='return editor.attach(editor.self), (this.disabled = true), (this.previousElementSibling.disabled = false), console.log(editor), false;') Attach
button(disabled onclick='return editor.attach(), (this.disabled = true), (this.previousElementSibling.disabled = false), console.log(editor), false;') Attach
20 changes: 10 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<meta content="#000" name="theme-color">
<meta content="width=device-width" name="viewport">
<meta content="A text selection range API written in pure JavaScript, for modern browsers." name="description">
<title>Text Editor 4.1.3</title>
<title>Text Editor 4.1.4</title>
<link href="../layout/index.min.css" rel="stylesheet">
</head>
<body>
<p role="alert">Do you like this project? Please support my <a href="https://github.com/mecha-cms">Mecha CMS</a> project too. Thank you!</p>
<header>
<h1>Text Editor 4.1.3</h1>
<h1>Text Editor 4.1.4</h1>
<p>Text Editor is a simple JavaScript application that aims to provide accessibility enhancements to the native HTML <code>&lt;textarea&gt;</code> elements, allowing users to control and manipulate their data in the text editor as they wish. It contains very sufficient methods to manipulate the existing text selection range data without providing unnecessary features. This keeps the file size small and the learning curve low, so you can fully focus on the results.</p>
<hr>
</header>
Expand Down Expand Up @@ -91,11 +91,18 @@ <h3><code>state.with</code></h3>
<h2 id="methods"><a href="#methods">#</a> Methods</h2>
<h3>Instance Methods</h3>
<p>Instance methods are methods that are available through the results of a <code>TextEditor</code> construct.</p>
<h4><code>editor.$()</code></h4>
<p>Get current text selection data.</p>
<pre><code>// `a<mark>b</mark>c`
console.log(editor.$()); // `{"after":"c","before":"a","end":2,"length":1,"start":1,"value":"b"}`</code></pre>
<h4><code>editor.attach(self, state)</code></h4>
<p>Re-initialize the application and its extensions after it has been detached.</p>
<pre><code>editor.attach(editor.self);</code></pre>
<pre><code>editor.attach();</code></pre>
<h4><code>editor.blur()</code></h4>
<p>Blur from the <code>&lt;textarea&gt;</code> element.</p>
<h4><code>editor.detach()</code></h4>
<p>Disable the application methods (except for the <code>attach()</code> method) and execute the <code>detach()</code> method of the extensions, if they are present.</p>
<pre><code>editor.detach();</code></pre>
<h4><code>editor.fire(event, data)</code></h4>
<p>Fire an event.</p>
<pre><code>editor.fire('change', []);</code></pre>
Expand All @@ -105,9 +112,6 @@ <h4><code>editor.focus(mode = 0)</code></h4>
editor.focus(-1); // Focus to the start of text area value
editor.focus(+1); // Focus to the end of text area value
editor.focus(true); // Select all</code></pre>
<h4><code>editor.detach()</code></h4>
<p>Disable the application methods (except for the <code>attach()</code> method) and execute the <code>detach()</code> method of the extensions, if they are present.</p>
<pre><code>editor.detach();</code></pre>
<h4><code>editor.get()</code></h4>
<p>Get current value of the <code>&lt;textarea&gt;</code> element if not empty, otherwise, return <code>null</code>.</p>
<h4><code>editor.insert(value, mode = 0, clear = false)</code></h4>
Expand Down Expand Up @@ -191,10 +195,6 @@ <h4><code>editor.wrap(open, close, wrap = false)</code></h4>
<p>Wrap current selection with <var>open</var> and <var>close</var>.</p>
<pre><code>editor.wrap('&lt;', '&gt;'); // Wrap with `&lt;` and `&gt;`
editor.wrap('&lt;', '&gt;', true); // Wrap with `&lt;` and `&gt;` then select</code></pre>
<h4><code>editor.$()</code></h4>
<p>Get current text selection data.</p>
<pre><code>// `a<mark>b</mark>c`
console.log(editor.$()); // `{"after":"c","before":"a","end":2,"length":1,"start":1,"value":"b"}`</code></pre>
<h3>Static Methods</h3>
<p>Static methods are methods that are directly available on the <code>TextEditor</code> object.</p>
<h4><code>TextEditor.esc(value)</code></h4>
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
return current;
};
};
TextEditor.version = '4.1.3';
TextEditor.version = '4.1.4';
TextEditor.x = x;
Object.defineProperty(TextEditor, 'name', {
value: 'TextEditor'
Expand Down
Loading

0 comments on commit c5ff807

Please sign in to comment.