Skip to content

Commit

Permalink
fix(mail-merge): Keep column links state properly in sync nylas#2493
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jstejada committed Jul 22, 2016
1 parent 941708d commit 7b02076
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions spec/components/table/table-data-source-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion src/components/contenteditable/editor-api.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/components/table/table-data-source.es6
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion src/pro
Submodule pro updated from aac7ee to 14db8b

0 comments on commit 7b02076

Please sign in to comment.