raw-payload-editor

WebJar for raw-payload-editor

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

org.webjars.bowergithub.advanced-rest-client
ArtifactId

ArtifactId

raw-payload-editor
Last Version

Last Version

2.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

raw-payload-editor
WebJar for raw-payload-editor
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/advanced-rest-client/raw-payload-editor

Download raw-payload-editor

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bowergithub.advanced-rest-client/raw-payload-editor/ -->
<dependency>
    <groupId>org.webjars.bowergithub.advanced-rest-client</groupId>
    <artifactId>raw-payload-editor</artifactId>
    <version>2.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bowergithub.advanced-rest-client/raw-payload-editor/
implementation 'org.webjars.bowergithub.advanced-rest-client:raw-payload-editor:2.0.1'
// https://jarcasting.com/artifacts/org.webjars.bowergithub.advanced-rest-client/raw-payload-editor/
implementation ("org.webjars.bowergithub.advanced-rest-client:raw-payload-editor:2.0.1")
'org.webjars.bowergithub.advanced-rest-client:raw-payload-editor:jar:2.0.1'
<dependency org="org.webjars.bowergithub.advanced-rest-client" name="raw-payload-editor" rev="2.0.1">
  <artifact name="raw-payload-editor" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bowergithub.advanced-rest-client', module='raw-payload-editor', version='2.0.1')
)
libraryDependencies += "org.webjars.bowergithub.advanced-rest-client" % "raw-payload-editor" % "2.0.1"
[org.webjars.bowergithub.advanced-rest-client/raw-payload-editor "2.0.1"]

Dependencies

compile (9)

Group / Artifact Type Version
org.webjars.bowergithub.polymer : polymer jar [2.0.0,3)
org.webjars.bowergithub.polymerelements : iron-resizable-behavior jar [2.0.0,3)
org.webjars.bowergithub.advanced-rest-client : code-mirror jar [2.0.0,3)
org.webjars.bowergithub.polymerelements : paper-toast jar [2.1.0,3)
org.webjars.bowergithub.advanced-rest-client » code-mirror-hint jar [1.0.0,2)
org.webjars.bowergithub.advanced-rest-client : payload-parser-behavior jar [2.0.0,3)
org.webjars.bowergithub.advanced-rest-client » events-target-behavior jar [2.0.0,3)
org.webjars.bowergithub.advanced-rest-client : code-mirror-linter jar [2.0.1,3)
org.webjars.bowergithub.polymerelements : paper-button jar [2.1.0,3)

Project Modules

There are no modules declared in this project.

Published on NPM

Build Status

Published on webcomponents.org

<raw-payload-editor>

An element with CodeMirror editor to allow the user to enter HTTP message body.

Breaking Changes in v3

  1. Upgrade

The element now uses LitElement library instead of Polymer. This means that all attributes are lowercase without - characters. For example, previously the lineSeparator property was reflected to line-separator attribute. Now it is lineseparator attribute.

  1. Tab handling

CodeMirror traps focus in the editor area. This is not accessible way of handling user input. Because of that this element overrides default tab key behavior and removes focus from the element.

  1. Required imports

This version uses latest and final specs for web components. This means the component works as a ES module. Because of that CodeMirror and any related library has to be included into the document before inserting this element to the DOM. CodeMirror 6 possibly will be working with ES imports but this is not set in stone at the moment.

Below is the default set of scripts to be added to the document.

<script src="node_modules/codemirror/lib/codemirror.js"></script>
<script src="node_modules/codemirror/addon/mode/loadmode.js"></script>
<script src="node_modules/codemirror/mode/meta.js"></script>
<!--Default set of parsers -->
<script src="node_modules/codemirror/mode/javascript/javascript.js"></script>
<script src="node_modules/codemirror/mode/xml/xml.js"></script>
<script src="node_modules/codemirror/mode/htmlmixed/htmlmixed.js"></script>

If you are using JSON linter

<script src="node_modules/jsonlint/lib/jsonlint.js"></script>
<script src="node_modules/codemirror/addon/lint/lint.js"></script>
<script src="node_modules/codemirror/addon/lint/json-lint.js"></script>
<link rel="stylesheet" href="node_modules/codemirror/addon/lint/lint.css" />

Finally, if your application will use modes that aren't included in the document, you should set import URI. This will be used to resolve modes dependencies.

<script>
CodeMirror.modeURL = 'node_modules/codemirror/mode/%N/%N.js';
</script>

API components

This components is a part of API components ecosystem

Usage

Installation

npm install --save @advanced-rest-client/raw-payload-editor

In an html file

<html>
  <head>
    <script type="module">
      import '@advanced-rest-client/raw-payload-editor/raw-payload-editor.js';
    </script>
  </head>
  <body>
    <raw-payload-editor contenttype="application/json"></raw-payload-editor>
    <script>
    {
      document.querySelector('raw-payload-editor').onvalue = (e) => {
        console.log(e.target.value);
      }
    }
    </script>
  </body>
</html>

In a LitElement

import { LitElement, html } from 'lit-element';
import '@advanced-rest-client/code-mirror/code-mirror.js';

class SampleElement extends PolymerElement {
  render() {
    return html`
    <code-mirror contenttype="application/json" @value-changed="${this._valueHandler}"></code-mirror>
    `;
  }

  _valueHandler(e) {
    this.value = e.detail.value;
  }
}
customElements.define('sample-element', SampleElement);

development

git clone https://github.com/advanced-rest-client/raw-payload-editor
cd raw-payload-editor
npm install

Running the demo locally

npm start

Running the tests

npm test
org.webjars.bowergithub.advanced-rest-client

ARC

A set of repositories related to the Advanced REST Client and API console (by Mulesoft)

Versions

Version
2.0.1