-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
84 lines (63 loc) · 2.85 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
nawte 0.4
=========
Nawte stands for "Not a WYSIWYG editor". By that I mean that you will not see text
transformation/formatting etc. as you would in a regular WYSIWYG editor (which are
usually tied to one specific language). Nawte was made with one goal in mind: to be
as simple as possible, and to let you do what you need with it. Nawte itself isn't
tied to any language. You can use it with html, markup, BBCode, textile, wiki markup
or any other markup language you can think of.
How does it work?
=================
Well it's quite simple actually, nawte ties itself to a textarea, then it gives you
a set of functions (and, most importantly; it gives you the possibility to add your
own functions), so that you can transform the textbox into a simple editor. The very
base of the concept is the "addFunction" method. When you add a new function to nawte
(for example let's say you add the "bold" function), nawte will add a bold button just
above your textbox, and perform the text modification that you want it to perform. It's
as simple as that, but with nawte's helper functions and simplicity, it allows you to
do pretty much anything you want....
Available Functions
===================
This is just a list of all functions/methods with a brief description. Note that a full
documentation can be found here:
http://www.silverscripting.com/nawte/Docs/files/nawte-0-3-js.html
The documentation is for version 0.3, but so far 0.4 only adds compatibility with mootools 1.2
so 0.3's doc is still useful.
nawte()
-------
The constructor... takes a textarea, an unordered list and a set of options...
onchange()
----------
nawte dispatches a change event when a button was clicked or when text was pasted into
it (which a regular textbox won't do).
addFunction()
-------------
The core of nawte. With this function you add your own custon functionality like "Bold"
or "Italic" or "Link to:" etc. anything you can think of, you can probably do it. You
will use "text-transform" methods in your functions (described below)...
getSelection()
--------------
This function returns the textbox's currently selected text.
wrapSelection(text)
-------------------
Wraps the textbox's selection with "text".
insert(before/after, text)
--------------------------
Inserts text before or after the selection.
replaceSelection(text)
----------------------
Replaces the current selection with "text".
processEachLines(callback)
--------------------------
Will process each lines of the selection with "callback".
More information
================
More info (deployment etc..) can be found at nawte's webpage:
http://www.silverscripting.com/nawte
License
=======
Nawte is released under the MIT license: http://www.opensource.org/licenses/mit-license.php
Author
======
Nawte was coded by Jean-Nicolas Jolivet (www.silverscripting.com). Based on a prototype script
called Control.Textarea.