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

Multiple editors bug #16

Open
abram27 opened this issue Jan 14, 2020 · 0 comments
Open

Multiple editors bug #16

abram27 opened this issue Jan 14, 2020 · 0 comments

Comments

@abram27
Copy link

abram27 commented Jan 14, 2020

When I add another froala editor to an observable array it displays a different value in an editor already existing.

       <div id='myView'>
		<div data-bind="foreach:questions">
			<textarea data-bind="value:questionLabel, froala: questionLabel, froalaOptions: $root.editorOptions"></textarea>
		</div>
		
		<button data-bind="click:addItem">Add Item</button>
	</div>  
	
	<script type="text/javascript">
		function Model()
		{
			const self = this;
			this.questions = ko.observableArray([{
				questionLabel:'first item'
			},{
				questionLabel:'second item'
			}]);
			
			this.addItem = function(){
				self.questions.push({questionLabel:'third item'});
			}
						
			this.editorOptions = {
                key: <froalaKey>,
                enter: FroalaEditor.ENTER_BR,
                charCounterCount: false,
                //initOnClick: true,
                toolbarButtons: ['bold', 'italic', 'underline', '|', 'align', 'outdent', 'indent', '|', 'insertLink', 'insertImage', 'insertVideo', 'insertFile',
                    '|', 'clearFormatting', 'html', "|", 'undo', 'redo']
                
            }
		};
		let model = new Model();
		ko.applyBindings(model, document.getElementById('myView'));
	</script>

In this example it changes the display value of 'second item' when I click the add item button.

abram27 pushed a commit to abram27/knockout-froala that referenced this issue Feb 10, 2020
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