@lvce-editor/main-area-worker 9.7.0 → 9.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4005,6 +4005,17 @@ const loadContent = async (state, savedState) => {
4005
4005
  };
4006
4006
  };
4007
4007
 
4008
+ const hasTargetGroup = groupId => {
4009
+ return groupId !== undefined && groupId >= 0;
4010
+ };
4011
+
4012
+ const getMenuEntryArgs = groupId => {
4013
+ if (!hasTargetGroup(groupId)) {
4014
+ return undefined;
4015
+ }
4016
+ return [groupId];
4017
+ };
4018
+
4008
4019
  const emptyObject = {};
4009
4020
  const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
4010
4021
  const i18nString = (key, placeholders = emptyObject) => {
@@ -4138,15 +4149,6 @@ const menuEntrySeparator = {
4138
4149
  label: ''
4139
4150
  };
4140
4151
 
4141
- const hasTargetGroup = groupId => {
4142
- return groupId !== undefined && groupId >= 0;
4143
- };
4144
- const getArgs = groupId => {
4145
- if (!hasTargetGroup(groupId)) {
4146
- return undefined;
4147
- }
4148
- return [groupId];
4149
- };
4150
4152
  const getNewWindowMenuEntries = state => {
4151
4153
  if (state.platform !== Electron) {
4152
4154
  return [];
@@ -4158,8 +4160,9 @@ const getNewWindowMenuEntries = state => {
4158
4160
  label: newWindow$1()
4159
4161
  }];
4160
4162
  };
4163
+
4161
4164
  const getMenuEntries$2 = (state, groupId) => {
4162
- const groupArgs = getArgs(groupId);
4165
+ const groupArgs = getMenuEntryArgs(groupId);
4163
4166
  const entries = [{
4164
4167
  args: [QuickPick, 'file'],
4165
4168
  command: 'Viewlet.openWidget',
@@ -4985,12 +4988,13 @@ const renderEditorGroupHeader = (group, groupIndex, splitButtonEnabled) => {
4985
4988
  }, ...getTabsVirtualDom(group, groupIndex, tabsChildCount), ...actions];
4986
4989
  };
4987
4990
 
4991
+ const emptyHeader = {
4992
+ childCount: 1,
4993
+ className: EmptyGroupHeader,
4994
+ type: Div
4995
+ };
4988
4996
  const renderEmptyGroupCloseButton = (group, groupIndex) => {
4989
- return [{
4990
- childCount: 1,
4991
- className: EmptyGroupHeader,
4992
- type: Div
4993
- }, {
4997
+ return [emptyHeader, {
4994
4998
  childCount: 1,
4995
4999
  className: EmptyGroupCloseButton,
4996
5000
  'data-groupId': String(group.id),
@@ -5235,6 +5239,9 @@ const renderEventListeners = () => {
5235
5239
  const saveEditor = async editorUid => {
5236
5240
  await invoke('Editor.save', editorUid);
5237
5241
  };
5242
+ const getEditorSaveState = async editorUid => {
5243
+ return invoke('Editor.saveState', editorUid);
5244
+ };
5238
5245
 
5239
5246
  const save = async state => {
5240
5247
  const activeTabData = getActiveTab(state);
@@ -5251,6 +5258,10 @@ const save = async state => {
5251
5258
  if (!tab.isDirty) {
5252
5259
  return state;
5253
5260
  }
5261
+ const editorState = await getEditorSaveState(tab.editorUid);
5262
+ if (editorState.modified) {
5263
+ return state;
5264
+ }
5254
5265
  return updateTab(state, tab.id, {
5255
5266
  isDirty: false
5256
5267
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "9.7.0",
3
+ "version": "9.8.0",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",