Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

Ability to invoke editor programatically #14

Closed
jrust opened this issue Jul 24, 2017 · 3 comments
Closed

Ability to invoke editor programatically #14

jrust opened this issue Jul 24, 2017 · 3 comments

Comments

@jrust
Copy link
Contributor

jrust commented Jul 24, 2017

I'd like to be able to invoke the editor programatically so that user can click a link and have editor turn on. Right now I'm manually triggering a click event with jQuery which is less than ideal. I'm thinking another directive binding, maybe isEditing, and if it switches to true then it invokes the onClick function and when it goes false triggering the blur function. Thoughts or better solutions welcome.

@b4dnewz
Copy link
Member

b4dnewz commented Jul 24, 2017

I think is possible right now by doing something like this:

<h2 id="title" ng-model="myModel" content-editable>Change me if you like.</h2>

Than using angular element which is a jquery light wrapper for angular:

$scope.editTitle = function() {
  // this will start the editing mode on element
  angular.element('#title')[0].focus()
}

I didn't tested it, but i'm pretty sure it will work, let me know if you have any trouble.

@jrust
Copy link
Contributor Author

jrust commented Jul 24, 2017

Yup, something like that does work, but it just breaks the angular paradigm of keeping the html declarative. I can make a PR to try is-editing idea -- just wanted to run the implementation idea above by you.

@b4dnewz
Copy link
Member

b4dnewz commented Jul 25, 2017

Yes you can for sure, I will appreciate any PR or improvement suggestions!

Have you already wonder how could this work in your idea? (how to trigger the edit-mode)

Sorry for my macaronic english.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants