All Projects → cathalsurfs → ng-contenteditable

cathalsurfs / ng-contenteditable

Licence: LGPL-3.0 license
ng-contenteditable

Programming Languages

CSS
56736 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to ng-contenteditable

Angular Prest
pREST component for Angular
Stars: ✭ 16 (-60.98%)
Mutual labels:  angularjs, angular-directives
Angular Datepicker
Angularjs datepicker module, generate a datepicker on your input element - https://720kb.github.io/angular-datepicker
Stars: ✭ 486 (+1085.37%)
Mutual labels:  angularjs, angular-directives
angular-openweather-app
A weather forecast app written in AngularJS
Stars: ✭ 54 (+31.71%)
Mutual labels:  angularjs, angular-directives
Ngx Quill Editor
🍡@quilljs editor component for @angular
Stars: ✭ 234 (+470.73%)
Mutual labels:  angularjs, angular-directives
Angular Fx
Angular CSS3 animation directives (ngfx-bounce, ngfx-shake, ngfx-flip, ngfx-pulse and more ...) https://720kb.github.io/angular-fx
Stars: ✭ 181 (+341.46%)
Mutual labels:  angularjs, angular-directives
Semanticui Angular
Angular Directives for Semantic UI
Stars: ✭ 58 (+41.46%)
Mutual labels:  angularjs, angular-directives
Angular Tooltips
Angularjs tooltips module, add tooltips to your elements - https://720kb.github.io/angular-tooltips
Stars: ✭ 357 (+770.73%)
Mutual labels:  angularjs, angular-directives
Angular Promise Buttons
Chilled loading buttons for AngularJS
Stars: ✭ 156 (+280.49%)
Mutual labels:  angularjs, angular-directives
Angular Query Builder
Dynamic query building UI written in Angular.
Stars: ✭ 211 (+414.63%)
Mutual labels:  angularjs, angular-directives
angular-downloader
Angular Downloader is an angularjs directive that enables you to manage browser download - https://720kb.github.io/angular-downloader
Stars: ✭ 16 (-60.98%)
Mutual labels:  angularjs, angular-directives
ADM-treeView
Pure AngularJs TreeView
Stars: ✭ 30 (-26.83%)
Mutual labels:  angularjs
Angular4-seed
Angular 4 Seed for Angular Forms
Stars: ✭ 37 (-9.76%)
Mutual labels:  angularjs
frontend-boilerplate
Frontend boilerplate for modern day web applications (update: not that modern anymore, go use React instead)
Stars: ✭ 64 (+56.1%)
Mutual labels:  angularjs
boomerang
Easy website for your GDG Chapter
Stars: ✭ 74 (+80.49%)
Mutual labels:  angularjs
angularjs-jest-example
✅ AngularJs with Jest example
Stars: ✭ 13 (-68.29%)
Mutual labels:  angularjs
angular-advanced-course
Angular Advanced Library Laboratory Course - Build Your Own Library
Stars: ✭ 82 (+100%)
Mutual labels:  angular-directives
misbehave
Add IDE-like text entry to HTML contenteditable tags
Stars: ✭ 34 (-17.07%)
Mutual labels:  contenteditable
angular-heremaps
AngularJS directive for working with Here Maps
Stars: ✭ 19 (-53.66%)
Mutual labels:  angularjs
percy-node
Utilities for visual regression testing in node based testing setups (like Protractor) for use with percy.io
Stars: ✭ 17 (-58.54%)
Mutual labels:  angularjs
angular-barcode
An angular directive for lindell's JsBarcode
Stars: ✭ 25 (-39.02%)
Mutual labels:  angularjs

ngContentEditable

###Native contenteditable directive for AngularJS###

A handy set of features, designed primarily to enable arbitrary editing of specific content areas of a web page, on the fly!

Live Demo

Note this demo requires jQuery and Bootstrap 3 (because I just wanted to put together a quick and dirty demo).

Documentation (TODO)

Reference (see code comments)

Tests (see notes below)

##Requirements##

A browser that supports the contenteditable attribute and ideally, also supports HTML5 drag and drop specification is required.

Tested working with latest versions of Chrome.

Results with other browsers may vary and remain untested.

##Installation##

Your bog standard bower install...

bower install ngcontenteditable

#Usage#

##editable##

This directive can be declared on any element within the DOM. However it is intended to be limited in application to block style elements.

Drag and drop operations...

Directive declaration style is by class, by adding the "editable" class name to any elements you wish to enable with this extension. Provides native drag and drop functionality to editable regions (including reads from local file system). Provides two-way binding on contenteditable elements.

Example:

<div class="editable" data-ng-model="your.data.model">Some default static content...</div>

If your model data is not available, ngContentEditable will default to whatever static content you have contained within your element. This is handy (designers etc), when for example you are mocking up a web page, or you want to publish with initial static content the user can later modify. Subsequent changes can update to your model.

####Scope####

Any directives which are placed within an editable region (either implicitly or by user drag drop interaction), will be compiled dynamically. These directives will have access to the following property (as long as they are not defined with isolate scope):

$ngContentEditable (Object)

You can access this property (for example during linking phase of a directive) to determine if your directive is contained within an editable area. Linking of directives is also triggered when an editable-component is dragged or dropped into an editable region.

##editable-component##

Directive declaration is by class name. By adding the editable-component class name to any directives for which you want to preserve scope.

Note - preservation of scope may not be completely reliable. For safety, where the user selects a range which encompasses any editable-component directives, any subsequent drag event is cancelled (see configService.DISABLE_RANGE_OVER_EDITABLE_COMPONENT).

##editable-control##

Directive declaration is by class name, by adding the editable-control class name to any elements you wish to function as a command / button within your web page or application.

#Services#

##editable.dragHelperService##

Main thing here is the following method:

###registerDropHandler(options)###

Data transferred by drag, drop or paste operations is handled (and optionally transformed) based on registered MIME types. If no handler is registered, any drop event will be cancelled or any paste event will provide default behavior (testing required).

The registerDropHandler method provides a mechanism to register a drop handler for editable elements. In the demo provided, this method is called from the constructor function of directives which apply to specific HTML tags.

It takes the following options object as its only argument:

{
	types: [], 				// Array of strings, for each mime type you want to accept (e.g. ['image/jpeg', 'image/png', 'image/gif'])
	node: angular.element 	// Wrapped element which is inserted into editable region (DOM) during uploading phase, if any are associated with this type, for positive user feedback.
	format: Function 		// Callback function which passes single argument (data) to allow manipulation of inserted element on uploading phase completion (e.g. uploaded image final display).
}

##Other##

Other services which are available, but primarily for internal use are:

editable.utilityService (required by all)

editable.configService (required by editable directive)

editable.rangeHelperService (required by editable directive)

editable.commandHelperService (required by editable-control directive)

##Tests##

Sorry, tests are a bit sparse at the moment. For now, I've made available some basic sanity testing and testing around validation of two-way data binding on editable regions. Also, a little bit of range / selection interaction with editable regions, for good measure (for now).

Tests

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].