Skip to content

Commit db50bc6

Browse files
committed
adding textarea to options demo area
1 parent 43a75cc commit db50bc6

File tree

7 files changed

+84
-20
lines changed

7 files changed

+84
-20
lines changed

css/demo.css

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,58 @@
11

2-
.toolbarButton {
3-
width: 24px;
4-
height: 24px;
5-
padding: 0px;
2+
body, html {
3+
margin: 0;
4+
padding: 0;
5+
}
6+
7+
#toolbar {
8+
width: 100%;
9+
height: 12%;
10+
float: none;
11+
clear: both;
12+
background: #EEE;
13+
box-shadow: 0 -2px 6px #000;
14+
padding: 0.65% 0;
615
vertical-align: middle;
7-
text-align: center;
816
}
9-
.toolbarButton img {
10-
width: 12px;
11-
height: 12px;
17+
#toolbar > span {
18+
margin: 0 0 0 4px;
19+
}
20+
.toolbar {
21+
margin-left: 8px;
1222
}
1323

1424
#convertHTMLButton {
25+
height: 24px;
26+
width: 24px;
1527
position: fixed;
1628
bottom: 4px;
1729
right: 4px;
30+
padding: 0px;
31+
display: none;
32+
}
33+
#convertHTMLButton img {
34+
width: 12px;
35+
height: 12px;
1836
}
1937

20-
#editor {
38+
.editor {
2139
overflow: auto;
40+
display: none;
41+
padding: 1%;
42+
}
43+
div.editor {
2244
outline: 1px solid transparent;
23-
height: 100%;
45+
height: 79%;
2446
}
47+
textarea.editor {
48+
width: 100%;
49+
height: 84%;
50+
border: none;
51+
resize: none;
52+
}
53+
.active {
54+
display: inline-block !important;
55+
}
56+
57+
2558

css/options.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ button img {
173173

174174
#demo {
175175
width: 100%;
176-
height: 128px;
176+
height: 172px;
177177
border: 1px solid #DDD;
178178
border-radius: 4px;
179179
margin: 8px 0;

demo.html

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,20 @@
77

88
<body>
99
<!-- toolbar -->
10-
<button id="convertHTMLButton" class="toolbarButton" type="button" title="Convert to HTML">
11-
<img src="images/third_party/open-iconic/code-2x.png" alt="" />
12-
</button>
10+
<div id="toolbar">
11+
<span>Switch Demo Element :</span>
12+
<input id="demoDivButton" class="toolbar" type="radio" name="editor" title="Switch to Editable Div" checked="checked" />
13+
<label for="demoDivButton">Editable Div</label>
14+
<input id="demoTextareaButton" class="toolbar" type="radio" name="editor" title="Switch to Demo Textarea" />
15+
<label for="demoTextareaButton">Textarea</label>
16+
17+
<button id="convertHTMLButton" class="active" type="button" title="Convert to HTML">
18+
<img src="images/third_party/open-iconic/code-2x.png" alt="" />
19+
</button>
20+
</div>
1321

1422
<!-- Rich text Editor -->
15-
<div id="editor" title="Shortcut Demo Editable Div" contenteditable=true>
23+
<div id="demoDiv" class="editor active" title="Shortcut Demo Editable Div" contenteditable=true>
1624
Try your shortcuts here! Make sure to save them first.
1725
<br /><br />
1826
Want to spice things up with a little HTML? Draft up your content with
@@ -22,6 +30,15 @@
2230
Now you can simply copy and paste the HTML to put into your expansions!
2331
</div>
2432

33+
<!-- Textarea Editor -->
34+
<textarea id="demoTextArea" class="editor" title="Shortcut Demo Textarea">
35+
Try your shortcuts here! Make sure to save them first.
36+
37+
This is a textarea, which doesn't support HTML, but can add multiline text.
38+
39+
Switch to the editable div to test HTML expansions!
40+
</textarea>
41+
2542
</body>
2643

2744
<!-- Javascript -->

js/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var SHORTCUT_PREFIX = '@' // Prefix to distinguish shortcuts vs me
99
el.appendChild(document.createComment(CURSOR_TRACKING_TAG));
1010
return el.innerHTML;
1111
})()
12-
, APP_VERSION = '1.8.1' // App version to check against shortcut database
12+
, APP_VERSION = '1.8.2' // App version to check against shortcut database
1313
, APP_FIRST_RUN_KEY = 'autoTextExpanderFirstRun' // Local key to check for first run
1414
, APP_BACKUP_KEY = 'autoTextExpanderBackup' // Local key for backups
1515
, APP_BACKUP_TIMESTAMP_KEY = 'autoTextExpanderBackupTimestamp' // Local backup timestamp

js/demo.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,23 @@
66
$('#convertHTMLButton').click(function(event)
77
{
88
console.log("convertHTMLButton clicked");
9-
var text = $('#editor').get(0).innerHTML;
9+
var text = $('#demoDiv').get(0).innerHTML;
1010
console.log('HTML:', text);
11-
$('#editor').text(text);
11+
$('#demoDiv').text(text);
12+
});
13+
14+
$('#demoDivButton').click(function(event)
15+
{
16+
$('#convertHTMLButton').addClass('active');
17+
$('#demoDiv').addClass('active');
18+
$('#demoTextArea').removeClass('active');
19+
});
20+
21+
$('#demoTextareaButton').click(function(event)
22+
{
23+
$('#convertHTMLButton').removeClass('active');
24+
$('#demoTextArea').addClass('active');
25+
$('#demoDiv').removeClass('active');
1226
});
1327

1428
})(jQuery);

js/expander.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ jQuery.noConflict();
813813
$target.on(EVENT_NAME_LOAD, function(event) // On load
814814
{
815815
debugLog("Attempting to attach listeners to new iframe");
816-
var $iframe = $(this);
816+
var $iframe = $(this)
817817
, iframeOrigin = $iframe.get(0).contentDocument.location.origin;
818818
try
819819
{

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "__MSG_EXTENSION_NAME__"
33
, "short_name": "__MSG_EXTENSION_SHORTNAME__"
4-
, "version": "1.8.1"
4+
, "version": "1.8.2"
55
, "manifest_version": 2
66
, "description": "__MSG_EXTENSION_DESCRIPTION__"
77
, "icons": {

0 commit comments

Comments
 (0)