@shashimadushan/docx-editor-react-native-legal
v0.1.0
Published
Sri Lankan legal templates & clauses plugin for @shashimadushan/docx-editor-react-native — adds the mobile Insert tab's Templates/Clauses pickers and the matching agent tools. Install it only if you need them; don't, and none of their code is in your app
Maintainers
Readme
@shashimadushan/docx-editor-react-native-legal
Sri Lankan legal templates and clauses for
@shashimadushan/docx-editor-react-native — deeds, powers of
attorney, affidavits, agreements and pleadings — packaged as a plugin.
Install it only if you need them. Don't, and none of this code is in your app bundle.
pnpm add @shashimadushan/docx-editor-react-native-legalUsage
import { DocxEditorView } from '@shashimadushan/docx-editor-react-native';
import { legalTemplatesPlugin } from '@shashimadushan/docx-editor-react-native-legal';
<DocxEditorView plugins={[legalTemplatesPlugin()]} />;That's the whole API. Installing the package is the opt-in — there's no flag to switch on.
What it adds
- A "Templates" picker in the mobile toolbar's Insert tab, backed by
@shashimadushan/docx-editor-legal-templates. Picking one inserts the rendered template; unfilled fields appear as[Field Label]placeholders for the user to edit. - A "Clauses" picker alongside it, for reusable boilerplate.
- Agent tools (
createLegalTools) — browse and instantiate templates, and run a compliance check against a template's known requirements (witnesses / notarial attestation / stamp duty).
The agent tools only do something when
@shashimadushan/docx-editor-react-native-agent is
also installed. The two packages find each other through the core's plugin
runtime — neither imports the other, and installing only one is fine.
Host-provided templates (DocxEditorView's templates /
onGetTemplateHtml props) coexist in the same picker: an id this plugin
doesn't recognize falls through to your handler, so neither side needs a
namespace prefix.
Migrating from legalTemplates
-<DocxEditorView legalTemplates />
+<DocxEditorView plugins={[legalTemplatesPlugin()]} />The old boolean warns and does nothing on its own now — it used to gate code that shipped in the WebView bundle for every consumer regardless, and that code isn't there anymore.
How it works
See ARCHITECTURE_PLAN.md §5B in the
core package, and the agent plugin's README for the same summary. The chunk is
~88 kB, almost all of it template content.
License
MIT
