oasis-editor 0.0.19 → 0.0.20

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.
@@ -1,4 +1,5 @@
1
1
  import { OasisPlugin } from '../../core/plugin.js';
2
+ import { EditorPageMargins } from '../../core/model.js';
2
3
  import { TextCaseMode } from '../../core/commands/text.js';
3
4
  import { ToolbarStyleState } from '../../ui/toolbarStyleState.js';
4
5
 
@@ -108,10 +109,8 @@ export interface EssentialsSectionCapability {
108
109
  setOrientation: (orientation: "portrait" | "landscape") => void;
109
110
  breakNextPage: () => void;
110
111
  breakContinuous: () => void;
111
- setPageMargins: (margins: {
112
- left?: number;
113
- right?: number;
114
- }) => void;
112
+ getMargins: () => EditorPageMargins | undefined;
113
+ setPageMargins: (margins: Partial<EditorPageMargins>) => void;
115
114
  }
116
115
  export interface EssentialsTableCapability {
117
116
  insideTable: () => boolean;
@@ -0,0 +1,7 @@
1
+ import { JSX } from 'solid-js';
2
+ import { ToolbarActionApi } from '../schema/items.js';
3
+
4
+ /** Word-style page-margin presets dropdown plus an inline custom form. */
5
+ export declare function MarginsGroup(props: {
6
+ api: ToolbarActionApi;
7
+ }): JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { TranslationKey } from '../../../i18n/index.js';
2
+
3
+ /** Convert a centimetre measurement to a rounded pixel value. */
4
+ export declare function cmToPx(cm: number): number;
5
+ /** Convert pixels back to centimetres (for display in the custom form). */
6
+ export declare function pxToCm(px: number): number;
7
+ export interface MarginPreset {
8
+ id: string;
9
+ labelKey: TranslationKey;
10
+ /** Margins in centimetres, mirroring Word's presets. */
11
+ top: number;
12
+ bottom: number;
13
+ left: number;
14
+ right: number;
15
+ }
16
+ /**
17
+ * Word's built-in page-margin presets (values shown in the screenshot use the
18
+ * pt-BR localisation: "Normal" follows ABNT 2.5/2.5/3/3 cm rather than 1 inch).
19
+ */
20
+ export declare const MARGIN_PRESETS: MarginPreset[];
21
+ /** Preset margins converted to the px units stored on the page settings. */
22
+ export declare function presetMarginsPx(preset: MarginPreset): {
23
+ top: number;
24
+ bottom: number;
25
+ left: number;
26
+ right: number;
27
+ };
28
+ /** True when the current px margins match this preset (±1px tolerance). */
29
+ export declare function marginsMatchPreset(margins: {
30
+ top: number;
31
+ bottom: number;
32
+ left: number;
33
+ right: number;
34
+ }, preset: MarginPreset): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis-editor",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",