Migration to @waline/client v1
V1 has several changes, the BREAKING CHANGEs are detailed in Initialization and Widget Change.
New Features
- Emoji preset support: You can now directly fill in the Emoji preset link to complete the Emoji configuration
- Multiple Emoji tabs: Emoji can now contain multiple tabs to add different types of Emoji
- Picture upload optimization: We added a picture upload button to remind visitors that they can upload pictures
- Drag and drop support: You can now directly drag and drop text or images into the comment box to complete text input or image addition.
- Responsive and SPA: Now Waline will return a responsive instance and supports SPA applications, see Responsive
Size reduction
The v1 version is a complete rewrite with Vue and TypeScript, so the size is reduced from 78.4kb to 54.0kb (gzip).
Options Change
The following options are marked as obsolete
, and are removed in v2.
placeholder
→ please uselocale.placeholder
optionTips
This change is to allow the default placeholder to adapt to multiple languages
emojiCDN
,emojiMaps
→ Please use the newemoji
optionTips
We have brought support for multiple Emoji tabs and Emoji presets. Emoji config should be easier for most users.
anonymous
→ please use the newlogin
optionTips
Since Waline brings login support, we will change:
anonymous: undefined
: anonymous comment and login are both possibleanonymous: true
: disable loginanonymous: false
: Cannot comment anonymously, that is, you can comment only after logging in
to:
login: 'enable'
: enable loginlogin: 'disable'
: disable loginlogin: 'force'
: Force login
This option should be more intuitive.
Options Rename
The original option has problems like unclear meaning and inconsistent naming. The following are the renamed options, and their behavior remains the same as before. These are also marked as obsolete
, and will be removed in v2.
langmode
→ renamed tolocale
Tips
This change improves the English meaning of options.
requiredFields
→ renamed torequiredMeta
Tips
This change is to align with the
meta
option.
Behavior change
Responsive
Now Waline will be fully responsive. Calling Waline will return a WalineInstance
. You can update the options of Waline by calling the update()
method on WalineInstance
, or use destroy()
method on WalineInstance
to destroy the instance.
This change will enable Waline to support SPA applications, please see SPA Support for details.
Initialization
Since the Waline function now returns a Waline instance, we strengthened the detection when Waline was initialized. If Waline cannot mount correctly. We will return a WalineErrorInstance
instance. There is only one errMsg
property on the instance to indicate the cause of the initialization error.
BREAKING CHANGE
If you just want Waline to update the number of comments and pageviews in the page, and do not need Waline mount on the current page, please DONOT set el
option explicitly.
Widget Change
BREAKING CHANGE
The RecentComments
will now return Promise<{ comment: CommentData[], destroy: () => void }>
instead of Promise<CommentData[]>
.