Skip to content

Commit

Permalink
Merge pull request #33 from jywarren/prompt-table-cleanup
Browse files Browse the repository at this point in the history
prompt and table cleanup plus stubbed Builder class
  • Loading branch information
jywarren authored Aug 15, 2016
2 parents a8e730b + 212f177 commit 556022a
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 70 deletions.
9 changes: 7 additions & 2 deletions dist/PublicLab.Editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@
min-height: 31px;
}

.ple-history {
overflow: scroll;
}

.ple-textarea,
.ple-textarea:focus,
.wk-wysiwyg {
Expand Down Expand Up @@ -127,8 +131,9 @@
background: #eee;
}

.ple-history {
overflow: scroll;
.wk-prompt {
border-radius: 10px;
padding: 20px;
}

/* Following may be removed if this is resolved:
Expand Down
84 changes: 51 additions & 33 deletions dist/PublicLab.Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -37009,13 +37009,18 @@ module.exports = PublicLab.History = Class.extend({
$(element).append(html);

$(element).find('.' + className + ' a.revert').click(function(e) {

_editor.richTextModule.value(log.text);
$('.ple-menu-more').hide();
setTimeout(_editor.richTextModule.afterParse, 0);

});

$(element).find('.' + className + ' a.clear').click(function(e) {

_editor.history.log.splice(_editor.history.log.indexOf(log), 1);
$(element).find('.' + className).remove();

});

});
Expand Down Expand Up @@ -37348,46 +37353,59 @@ module.exports = function(textarea, _editor, _module) {
require('../modules/PublicLab.RichTextModule.Table.js')(_module, wysiwyg);


// styling:

$('.wk-commands').after('&nbsp; <span style="color:#888;display:none;" class="ple-history-saving btn"><i class="fa fa-clock-o"></i> <span class="hidden-xs">Saving...</span></span>');
$('.wk-commands, .wk-switchboard').addClass('btn-group');
$('.wk-commands button, .wk-switchboard button').addClass('btn btn-default');

$('.wk-commands button.woofmark-command-quote').addClass('hidden-xs');
$('.wk-commands button.woofmark-command-code').addClass('hidden-xs');
$('.wk-commands button.woofmark-command-ol').addClass('hidden-xs');
$('.wk-commands button.woofmark-command-attachment').addClass('hidden-xs');

$('.wk-switchboard button.woofmark-mode-markdown').parent().removeClass('btn-group');
$('.wk-switchboard button.woofmark-mode-markdown').html('<span class="visible-xs">#</span><span class="hidden-xs">Markdown</span>');
$('.wk-switchboard button.woofmark-mode-wysiwyg').html('<span class="visible-xs">Aa</span><span class="hidden-xs">Rich</span>');

if (wysiwyg.mode === 'wysiwyg') $('.wk-switchboard button.woofmark-mode-wysiwyg').hide();
else $('.wk-switchboard button.woofmark-mode-markdown').hide();

$('.wk-switchboard button').click(function() {
$('.wk-switchboard button.woofmark-mode-markdown').toggle();
$('.wk-switchboard button.woofmark-mode-wysiwyg').toggle();
});

if (_editor.options.size == "xs") {
wysiwyg.stylePrompt = function() {
$('.wk-prompt button, span.wk-prompt-browse').addClass('btn btn-default');
$('.wk-prompt input').addClass('input form-control')
.css('margin-bottom','5px');
}

//$('.wk-switchboard button,.wk-commands button').addClass('btn-xs');
$('.wk-commands button.woofmark-command-attachment, .wk-commands button.woofmark-command-image').click(wysiwyg.stylePrompt);

// hide selectively, not by #:
$('.wk-commands button.woofmark-command-quote').hide();
$('.wk-commands button.woofmark-command-code').hide();
$('.wk-commands button.woofmark-command-ol').hide();
$('.wk-commands button.woofmark-command-ul').hide();

} else {
wysiwyg.style = function() {

$('.wk-switchboard button').addClass('btn-sm');
$('.wk-commands').after('&nbsp; <span style="color:#888;display:none;" class="ple-history-saving btn"><i class="fa fa-clock-o"></i> <span class="hidden-xs">Saving...</span></span>');
$('.wk-commands, .wk-switchboard').addClass('btn-group');
$('.wk-commands button, .wk-switchboard button').addClass('btn btn-default');

$('.wk-commands button.woofmark-command-quote').addClass('hidden-xs');
$('.wk-commands button.woofmark-command-code').addClass('hidden-xs');
$('.wk-commands button.woofmark-command-ol').addClass('hidden-xs');
$('.wk-commands button.woofmark-command-attachment').addClass('hidden-xs');

$('.wk-switchboard button.woofmark-mode-markdown').parent().removeClass('btn-group');
$('.wk-switchboard button.woofmark-mode-markdown').html('<span class="visible-xs">#</span><span class="hidden-xs">Markdown</span>');
$('.wk-switchboard button.woofmark-mode-wysiwyg').html('<span class="visible-xs">Aa</span><span class="hidden-xs">Rich</span>');

if (wysiwyg.mode === 'wysiwyg') $('.wk-switchboard button.woofmark-mode-wysiwyg').hide();
else $('.wk-switchboard button.woofmark-mode-markdown').hide();

$('.wk-switchboard button').click(function() {
$('.wk-switchboard button.woofmark-mode-markdown').toggle();
$('.wk-switchboard button.woofmark-mode-wysiwyg').toggle();
});

if (_editor.options.size == "xs") {

//$('.wk-switchboard button,.wk-commands button').addClass('btn-xs');

// hide selectively, not by #:
$('.wk-commands button.woofmark-command-quote').hide();
$('.wk-commands button.woofmark-command-code').hide();
$('.wk-commands button.woofmark-command-ol').hide();
$('.wk-commands button.woofmark-command-ul').hide();

} else {

$('.wk-switchboard button').addClass('btn-sm');

}

}


wysiwyg.style();

return wysiwyg;

}
Expand Down Expand Up @@ -37824,7 +37842,7 @@ module.exports = PublicLab.RichTextModule = PublicLab.Module.extend({
// converts to markdown and back to html, or the reverse,
// to trigger @callouts and such formatting
_module.parse = function() {
console.log('parse');

_module.value(_module.value());
_module.afterParse();

Expand Down
10 changes: 8 additions & 2 deletions examples/prepopulated.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,16 @@ <h1>Share</h1>
<option value="">a question or request</option>
<option value="">an event</option>
</select>
<div class="form-group" style="text-align:left;">
<div class="checkbox">
<label>
<input type="checkbox" checked="true"> Draft
</label>
</div>
</div>
</div>
<div class="col-xs-2" style="padding-top:10px;text-align:left;">
<a rel="tooltip" data-placement="bottom" title="Learn more about different posting types." class="ple-help-light" style="font-size:18px;"><i class="fa fa-question-circle"></i></a>

</div>
</div>
</div>
Expand Down Expand Up @@ -167,7 +173,7 @@ <h2>4</h2>
<span class="hidden-xs"> so that others may use it.</span>
</span>

<button class="ple-publish btn btn-lg btn-primary pull-right disabled">Publish</button>
<button rel="tooltip" data-placement="top" title="Post as a draft to get help refining your post." class="ple-publish btn btn-lg btn-primary pull-right disabled">Publish draft</button>

<span class="ple-help pull-right">
<span class="ple-steps-left">X</span>
Expand Down
25 changes: 25 additions & 0 deletions src/PublicLab.Builder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Methods to construct module HTML in the DOM
*/

module.exports = PublicLab.Builder = Class.extend({

init: function(_editor, options) {

var _builder = this;

_builder.options = options || {};

options.el = $(options.selector);


_builder.construct = function(module) {

// actually fill the element with HTML --

}


}

});
5 changes: 5 additions & 0 deletions src/PublicLab.History.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,18 @@ module.exports = PublicLab.History = Class.extend({
$(element).append(html);

$(element).find('.' + className + ' a.revert').click(function(e) {

_editor.richTextModule.value(log.text);
$('.ple-menu-more').hide();
setTimeout(_editor.richTextModule.afterParse, 0);

});

$(element).find('.' + className + ' a.clear').click(function(e) {

_editor.history.log.splice(_editor.history.log.indexOf(log), 1);
$(element).find('.' + className).remove();

});

});
Expand Down
77 changes: 45 additions & 32 deletions src/adapters/PublicLab.Woofmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,46 +204,59 @@ module.exports = function(textarea, _editor, _module) {
require('../modules/PublicLab.RichTextModule.Table.js')(_module, wysiwyg);


// styling:

$('.wk-commands').after('&nbsp; <span style="color:#888;display:none;" class="ple-history-saving btn"><i class="fa fa-clock-o"></i> <span class="hidden-xs">Saving...</span></span>');
$('.wk-commands, .wk-switchboard').addClass('btn-group');
$('.wk-commands button, .wk-switchboard button').addClass('btn btn-default');

$('.wk-commands button.woofmark-command-quote').addClass('hidden-xs');
$('.wk-commands button.woofmark-command-code').addClass('hidden-xs');
$('.wk-commands button.woofmark-command-ol').addClass('hidden-xs');
$('.wk-commands button.woofmark-command-attachment').addClass('hidden-xs');

$('.wk-switchboard button.woofmark-mode-markdown').parent().removeClass('btn-group');
$('.wk-switchboard button.woofmark-mode-markdown').html('<span class="visible-xs">#</span><span class="hidden-xs">Markdown</span>');
$('.wk-switchboard button.woofmark-mode-wysiwyg').html('<span class="visible-xs">Aa</span><span class="hidden-xs">Rich</span>');

if (wysiwyg.mode === 'wysiwyg') $('.wk-switchboard button.woofmark-mode-wysiwyg').hide();
else $('.wk-switchboard button.woofmark-mode-markdown').hide();

$('.wk-switchboard button').click(function() {
$('.wk-switchboard button.woofmark-mode-markdown').toggle();
$('.wk-switchboard button.woofmark-mode-wysiwyg').toggle();
});

if (_editor.options.size == "xs") {
wysiwyg.stylePrompt = function() {
$('.wk-prompt button, span.wk-prompt-browse').addClass('btn btn-default');
$('.wk-prompt input').addClass('input form-control')
.css('margin-bottom','5px');
}

//$('.wk-switchboard button,.wk-commands button').addClass('btn-xs');
$('.wk-commands button.woofmark-command-attachment, .wk-commands button.woofmark-command-image').click(wysiwyg.stylePrompt);

// hide selectively, not by #:
$('.wk-commands button.woofmark-command-quote').hide();
$('.wk-commands button.woofmark-command-code').hide();
$('.wk-commands button.woofmark-command-ol').hide();
$('.wk-commands button.woofmark-command-ul').hide();

} else {
wysiwyg.style = function() {

$('.wk-switchboard button').addClass('btn-sm');
$('.wk-commands').after('&nbsp; <span style="color:#888;display:none;" class="ple-history-saving btn"><i class="fa fa-clock-o"></i> <span class="hidden-xs">Saving...</span></span>');
$('.wk-commands, .wk-switchboard').addClass('btn-group');
$('.wk-commands button, .wk-switchboard button').addClass('btn btn-default');

$('.wk-commands button.woofmark-command-quote').addClass('hidden-xs');
$('.wk-commands button.woofmark-command-code').addClass('hidden-xs');
$('.wk-commands button.woofmark-command-ol').addClass('hidden-xs');
$('.wk-commands button.woofmark-command-attachment').addClass('hidden-xs');

$('.wk-switchboard button.woofmark-mode-markdown').parent().removeClass('btn-group');
$('.wk-switchboard button.woofmark-mode-markdown').html('<span class="visible-xs">#</span><span class="hidden-xs">Markdown</span>');
$('.wk-switchboard button.woofmark-mode-wysiwyg').html('<span class="visible-xs">Aa</span><span class="hidden-xs">Rich</span>');

if (wysiwyg.mode === 'wysiwyg') $('.wk-switchboard button.woofmark-mode-wysiwyg').hide();
else $('.wk-switchboard button.woofmark-mode-markdown').hide();

$('.wk-switchboard button').click(function() {
$('.wk-switchboard button.woofmark-mode-markdown').toggle();
$('.wk-switchboard button.woofmark-mode-wysiwyg').toggle();
});

if (_editor.options.size == "xs") {

//$('.wk-switchboard button,.wk-commands button').addClass('btn-xs');

// hide selectively, not by #:
$('.wk-commands button.woofmark-command-quote').hide();
$('.wk-commands button.woofmark-command-code').hide();
$('.wk-commands button.woofmark-command-ol').hide();
$('.wk-commands button.woofmark-command-ul').hide();

} else {

$('.wk-switchboard button').addClass('btn-sm');

}

}


wysiwyg.style();

return wysiwyg;

}
2 changes: 1 addition & 1 deletion src/modules/PublicLab.RichTextModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ module.exports = PublicLab.RichTextModule = PublicLab.Module.extend({
// converts to markdown and back to html, or the reverse,
// to trigger @callouts and such formatting
_module.parse = function() {
console.log('parse');

_module.value(_module.value());
_module.afterParse();

Expand Down

0 comments on commit 556022a

Please sign in to comment.