Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not always updated #2

Closed
Hube2 opened this issue Oct 27, 2016 · 2 comments
Closed

not always updated #2

Hube2 opened this issue Oct 27, 2016 · 2 comments

Comments

@Hube2
Copy link
Owner

Hube2 commented Oct 27, 2016

The content in the text field submitted when updating a post does not always get updated before the post is submitted. No idea what's causing this yet.

@Hube2
Copy link
Owner Author

Hube2 commented Oct 28, 2016

It has something to do with this yabwe/medium-editor#942

If I use a standard button after using a custom MediumButton then the field gets updated. But if I use the custom button last then that update is not recorded.

I asked a question here https://github.com/arcs-/MediumButton/issues/14, we'll see what happens. I can't see where I can apply the changes suggested in the medium editor issue to the medium button code.

@Hube2
Copy link
Owner Author

Hube2 commented Oct 28, 2016

I've hacked something together for this, for anyone that happens. For anyone that happens upon this in the future looking for to solve a similar problem. At least I think this solves the problem, need to do some more testing to be sure.

// instantiate MediumEditor
// this is from the docs there
var editor = new MediumEditor(selector, object);
// get the id value of the editor just created
var editorId = editor.elements[0].id;
// get this element in a form that we can pass back to medium editor as the target
var target = document.getElementById(editorId);
// get the textarea that for this editor
// in my case there is only one because each one has a unique ID
var targetObj = document.getElementById('my-unique-id');
// attach action DOMSubtreeModified to the editor
$('#'+editorId).bind('DOMSubtreeModified', function(e) {
    // force medium editor to update/refresh
    editor.events.updateInput($target, $targetObj);
});

Hube2 added a commit that referenced this issue Oct 28, 2016
Hube2 added a commit that referenced this issue Oct 28, 2016
@Hube2 Hube2 closed this as completed Oct 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant