fix(mail-merge): Keep column links state properly in sync #2493

Summary:
See https://phab.nylas.com/D3112 for full description
- Update EditorAPI.insertCustomComponent to take a pre-generated
anchorId

Test Plan: Unit tests + manual

Reviewers: bengotow, halla, jackie

Reviewed By: jackie

Differential Revision: https://phab.nylas.com/D3113
This commit is contained in:
Juan Tejada 2016-07-22 14:22:24 -07:00
parent 79d879ff79
commit f77cbc02f5
4 changed files with 7 additions and 7 deletions

View file

@ -69,14 +69,14 @@ describe('TableDataSource', function describeBlock() {
});
});
describe('removeColumn', () => {
describe('removeLastColumn', () => {
it('removes last column from the data source\'s columns', () => {
const res = testDataSource.removeColumn()
const res = testDataSource.removeLastColumn()
expect(res.columns()).toEqual(['col1', 'col2'])
});
it('removes last column from every row', () => {
const res = testDataSource.removeColumn()
const res = testDataSource.removeLastColumn()
expect(res.rows()).toEqual([
[1, 2],
[4, 5],

View file

@ -74,7 +74,7 @@ class EditorAPI
insertCustomComponent: (componentKey, props = {}) ->
OverlaidComponents ?= require('../overlaid-components/overlaid-components').default
{anchorId, anchorTag} = OverlaidComponents.buildAnchorTag(componentKey, props)
{anchorId, anchorTag} = OverlaidComponents.buildAnchorTag(componentKey, props, props.anchorId)
@insertHTML(anchorTag)
return anchorId

View file

@ -137,9 +137,9 @@ export default class TableDataSource {
* Removes last column and all of its data.
*
* @return {TableDataSource} - updated data source instance
* @method removeColumn
* @method removeLastColumn
*/
removeColumn() {
removeLastColumn() {
const nextRows = this.rows().map(row => row.slice(0, row.length - 1))
const nextColumns = this.columns().slice(0, this.columns().length - 1)
return new TableDataSource({

@ -1 +1 @@
Subproject commit aac7ee6017a38af8a93d1a352e5fe3c0153db4a0
Subproject commit 14db8b4122fbcb7d6a86f45651cd013a35fb5d9b