Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ Option|Description
**enable-bootstrap-title**| True/False whether or not to show the button hover title styled with bootstrap
**textarea-menu** | Cusomize the wysiwyg buttons and button groups ***See Below** If nothing is specified then the default buttons and groups will be shown.
**disabled** | Disable the buttons and wysiwig area
**style-with-css** | true/false flag to set style with css or not, default is true if not set
**enable-obj-resizing** | true/false flag to set enable obj resizing or not, default is true if not set

Buttons
--------------
Expand Down
26 changes: 15 additions & 11 deletions src/angular-wysiwyg.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ Usage: <wysiwyg textarea-id="question" textarea-class="form-control" textarea-h
textarea-id The id to assign to the editable div
textarea-class The class(es) to assign to the the editable div
textarea-height If not specified in a text-area class then the hight of the editable div (default: 80px)
textarea-name The name attribute of the editable div
textarea-name The name attribute of the editable div
textarea-required HTML/AngularJS required validation
textarea-menu Array of Arrays that contain the groups of buttons to show Defualt:Show all button groups
ng-model The angular data model
enable-bootstrap-title True/False whether or not to show the button hover title styled with bootstrap
enable-bootstrap-title True/False whether or not to show the button hover title styled with bootstrap

Requires:
Requires:
Twitter-bootstrap, fontawesome, jquery, angularjs, bootstrap-color-picker (https://github.com/buberdds/angular-bootstrap-colorpicker)

*/

/*
TODO:
TODO:
tab support
custom button fuctions

limit use of scope
use compile fuction instead of $compile
move button elements to js objects and use doc fragments
move button elements to js objects and use doc fragments
*/

(function(angular, undefined) {
Expand Down Expand Up @@ -67,6 +67,8 @@ Requires:
textareaCustomMenu: '=textareaCustomMenu',
fn: '&',
disabled: '=?disabled',
styleWithCss : '=',
enableObjResizing : "="
},
replace: true,
require: 'ngModel',
Expand Down Expand Up @@ -212,19 +214,19 @@ Requires:
}

ngModelController.$setViewValue(html);
});
});

textarea.on('keydown', function(event){
if (event.keyCode == 9){
var TAB_SPACES = 4;
var html = textarea.html();
var selection = window.getSelection();
var position = selection.anchorOffset;

event.preventDefault();
// html = insertTab(html, position);
// textarea.html(html);
// selection.collapse(textarea[0].firstChild, position + TAB_SPACES);
// selection.collapse(textarea[0].firstChild, position + TAB_SPACES);
}
});

Expand All @@ -235,7 +237,7 @@ Requires:
scope.isStrikethrough = scope.cmdState('strikethrough');
scope.isItalic = scope.cmdState('italic');
scope.isSuperscript = itemIs('SUP'); //scope.cmdState('superscript');
scope.isSubscript = itemIs('SUB'); //scope.cmdState('subscript');
scope.isSubscript = itemIs('SUB'); //scope.cmdState('subscript');
scope.isRightJustified = scope.cmdState('justifyright');
scope.isLeftJustified = scope.cmdState('justifyleft');
scope.isCenterJustified = scope.cmdState('justifycenter');
Expand Down Expand Up @@ -362,8 +364,10 @@ Requires:
scope.format('hiliteColor', scope.hiliteColor);
};

scope.format('enableobjectresizing', true);
scope.format('styleWithCSS', true);
scope.enableObjResizing = scope.enableObjResizing === undefined ? true : scope.enableObjResizing;
scope.format('enableobjectresizing', scope.enableObjResizing);
scope.styleWithCss = scope.styleWithCss === undefined ? true : scope.styleWithCss ;
scope.format('styleWithCSS', scope.styleWithCss);
}
})
.factory('wysiwgGui', function(wysiwgGuiElements) {
Expand Down