Giter VIP home page Giter VIP logo

ember-inline-edit's Introduction

Ember Observer Score CI npm version

ember-inline-edit

ember-inline-edit provides inline editing for your ember apps. Has basic keyboard support, too.

Installation

ember install ember-inline-edit

Usage

Use the ember-inline-edit component and provide it a default value.

<EmberInlineEdit @value={{this.value}} @onSave={{fn (mut this.value)}} />

This will give you a component that can be edited inline. To learn more, please check out our documentation.

Keyboard Support

Inside the inputs (the textarea, input fields, etc.), if the user hits enter, it does exactly what a click on the save button would do (i.e. sends an onSave action and closes the editor).

If the user hits esc, the editor closes and sends the onCancel action.

Issues? Bugs?

Please report any issues or bugs you find.

ember-inline-edit's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ember-inline-edit's Issues

Option for cancel link instead of button

Would you take a PR for an option that changes the cancel button to a link like in the screenshot below? If so, I forked and completed the code, just need to update the docs and I'll submit the PR.

tmd_software

is-hidden CSS class being applied by default

Version: 0.2.1
Ember version: 2.13.0

I took your example from your documentation and it seems that the default behavior is to hide the ember-inline-editable component. If I go into dev tools and disable the display:none property on .is-hidden and click on the text to edit, it looks that the parent div of the input field is also defaulting to hidden. I'm not sure if this is a bug or if I'm just missing some way to override this, but I'd appreciate any input!

Thank you!

'enabled' attribute removes existing text

Hi there, thanks for making this wonderful addon.

Currently I am trying to make this component non-editable when certain permissions are enabled in my system. I noted in the documentation that the enabled attribute is likely the way to go for this. However when set enabled to false, it removes the existing text of the component altogether. Checking the background HTML, I note that the text is completely gone from the element. Is there any way to make the component non-editable while still displaying its text?

Please and thanks!

Editing on iOS

The application I'm using ember-inline-edit works fine with the Chrome Browser on Android, but the same does not work with Chrome Browser(Or Safari) on iOS.
startEditing action is not being called on a touch action.
Is there something we'll have to add/modify in order to get it working on a browser running on iOS?
Inserting the code from the template where I'm using ember-inline-edit

{{ember-inline-edit value=<model>.<attr> onSave = (action "updateModel" <model>.id) onClose = (action "rollbackModel" <model>.id)}}

Quick noobie question

I followed the instruction in the readme but I'm having trouble saving the edited text.

In my routes/meals/show.js I have:

model(params) {
    return this.store.findRecord('meal', params.meal_id);
  },
actions: {
    changeName(val) {
      this.set('name', val);
    }
  }

but nothing happens at all. My backend doesn't get any messages. I know it's hitting the changeName function though, debugger works in it. This is in Ember 2.6 btw. Is there a step I am missing? Thanks!

Passing `showEditButton=true` to component doesn't work

Clicking on edit icon executes startEditing but right after that _handleClick catches the event and the required conditions fails hence it emits close event.

Solution is to modify startEditing method as below

-  startEditing () {
+  startEditing(event) {
      info('[ember-inline-edit] Got the `startEditing` action')
      Ember.run(this, function(){ set(this, 'isEditing', true) })
      this._focusOnInput()
+     event.stopPropagation();
    },

Unsuccessful save after loss of focus during editing

The following action sequence produces a state in which the control will not save properly:

  1. Click on the control.
  2. Change the selected option.
  3. Click anywhere outside the control so that the control closes. Notice that the original value is shown.
  4. Click on the control. Notice that the shown value is the modified value.
  5. Press the save button. Notice that the control still shows the original value, i.e. the save button didn't work.

Hints for rollback?

Hello folks, thanks for the awesome work on this addon!

I wanted to do a rollback feature through which, any changes get undone once onClose is triggered.

 rollback(id, prop, prevContent) {
    let obj = this.get('store').peekRecord(model, id);     
    obj.set(prop, prevContent);
 },

I thought of doing something like that, but didn't quite work out. Any tips / examples?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.