function test(arg1) {
  console.log(arg1)
}

function emrMenu(ctl, num) {
  //var ctl = document.getElementById("myWriterControl");
  //编辑器右键菜单

  var jsonMenu = [{
    cmdName: 'copy'
  },
    {
      label: '剪切(Ctrl + x)',
      cmdName: 'cut',
      exec: function() {
        ctl.DCExecuteCommand('Cut', true, null)
      }
    },
    {
      label: '粘贴',
      cmdName: 'paste',
      exec: function() {
        ctl.DCExecuteCommand('Paste', true, null) //粘贴内部复制或者剪切的
      }
    },
    '-',
    {
      label: '元素属性',
      // icon: 'aligntd',
      cmdName: 'aligntd',
      exec: function() {
        // console.log(that.myWriter.CurrnetElement())
        var currentElement = ctl.CurrnetElement()
        var currentInput = ctl.CurrentInputField()
        if (currentInput != null) {
          //that.updateElement = true
          //that.Element = currentInput
        } else {
          var a = $(currentElement).parents(
            '[dctype=\'XTextCheckBoxElementBaseLabel\']:first'
          )
          if (a.length == 1) {
            //that.updateElement = true
            //that.Element = a.parent().find('input')[0]
          }
        }
      }
    },
    '-',
    {
      label: '表格属性',
      cmdName: 'edittable',
      exec: function() {
        var CurrentTable = ctl.CurrentTable()
        if (CurrentTable != null) {
          //that.updateElement = true
          //that.Element = CurrentTable
        }
      }
    },
    {
      label: '表格行属性',
      cmdName: 'edittd',
      exec: function() {
        var CurrentTableRow = that.myWriter.CurrentTableRow()
        if (CurrentTableRow != null) {
          //that.updateElement = true
          //that.Element = CurrentTableRow
        }
      }
    },
    {
      label: '删除表格',
      cmdName: 'deletetable',
      exec: function() {
        var currenttable = ctl.CurrentTable()
        if (currenttable != null) {
          ctl.DCExecuteCommand('Table_DeleteTable', false, null)
        }
      }
    },
    {
      label: '删除表格行',
      cmdName: 'deleterow',
      exec: function() {
        var currentRow = ctl.CurrentTableRow()
        if (currentRow != null) {
          ctl.DCExecuteCommand('Table_DeleteRow', false, null)
        }
      }
    },
    {
      label: '在上方插入表格行',
      cmdName: 'insertrow',
      exec: function() {
        var currentRow = ctl.CurrentTableRow()
        if (currentRow != null) {
          ctl.DCExecuteCommand('Table_InsertRowUp', false, null)
        }
      }
    },
    {
      label: '在下方插入表格行',
      cmdName: 'insertrownext', //edui-for-insertrownext
      exec: function() {
        var currentRow = ctl.CurrentTableRow()
        if (currentRow != null) {
          ctl.DCExecuteCommand('Table_InsertRowDown', false, null)
        }
      }
    },
    {
      label: '在左方插入表格列',
      cmdName: 'insertcol',
      exec: function() {
        var currentRow = ctl.CurrentTableRow()
        if (currentRow != null) {
          ctl.DCExecuteCommand(
            'Table_InsertColumnLeft',
            false,
            null
          )
        }
      }
    },
    {
      label: '在右方插入表格列',
      cmdName: 'insertcolnext',
      exec: function() {
        var currentRow = ctl.CurrentTableRow()
        if (currentRow != null) {
          ctl.DCExecuteCommand(
            'Table_InsertColumnRight',
            false,
            null
          )
        }
      }
    },
    {
      label: '右合并单元格',
      cmdName: 'mergeright',
      exec: function() {
        var currentCell = that.myWriter.CurrentTableCell()
        if (currentCell != null) {
          ctl.DCExecuteCommand('mergeright', false, null)
        }
      }
    },
    {
      label: '下合并单元格',
      cmdName: 'mergedown',
      exec: function() {
        var currentCell = that.myWriter.CurrentTableCell()
        if (currentCell != null) {
          ctl.DCExecuteCommand('mergedown', false, null)
        }
      }
    }
  ]
  var jsonMenustr = []
  if (num == 5) {
    for (var i = 0; i < 5; i++) {
      jsonMenustr.push(jsonMenu[i])
    }
  }
  if (num == 0) {
    jsonMenustr = jsonMenu
  }
  // console.log(jsonMenustr);
  ctl.SetContextMenu(jsonMenustr)
}
