Skip to content

Commit 903a2f4

Browse files
line 65
1 parent 722b851 commit 903a2f4

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

  • 2-ui/4-forms-controls/3-events-change-input

2-ui/4-forms-controls/3-events-change-input/article.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131

3232
هر بار پس از آن که یک مقدار توسط کاربر تغییر می‌کند، `input` event فعال می‌شود.
3333

34-
Unlike keyboard events, it triggers on any value change, even those that does not involve keyboard actions: pasting with a mouse or using speech recognition to dictate the text.
34+
برعکس keyboard inputها، آن با هر تغییر مقداری فعال می‌شود، حتی آن‌هایی که شامل keyboard actions نمی‌شوند: paste کردن با یک موش یا استفاده از تشخیص گفتار برای دیکته کردن متن.
3535

36-
For instance:
36+
برای مثال:
3737

3838
```html autorun height=40 run
3939
<input type="text" id="input"> oninput: <span id="result"></span>
@@ -44,23 +44,25 @@ For instance:
4444
</script>
4545
```
4646

47-
If we want to handle every modification of an `<input>` then this event is the best choice.
47+
اگر بخواهیم تمام تغییرات یک `<input>` را هندل کنیم، آنگاه این event بهترین انتخاب است.
4848

49-
On the other hand, `input` event doesn't trigger on keyboard input and other actions that do not involve value change, e.g. pressing arrow keys `key:⇦` `key:⇨` while in the input.
49+
از طرفی دیگر، `input` event با keyboard input و فعالیت‌های دیگری که شامل تغییر value نمی‌شوند فعال نمی‌شود، مثل فشار دادن کلیدهای جهت‌دار `key:⇦` `key:⇨` زمانی که داخل input هستیم.
5050

51-
```smart header="Can't prevent anything in `oninput`"
52-
The `input` event occurs after the value is modified.
51+
```smart header="جلوگیری کرد. `oninput` نمی‌توان از چیزی در"
5352

54-
So we can't use `event.preventDefault()` there -- it's just too late, there would be no effect.
53+
بعد از اینکه value تغییر می‌کند، `input` event فعال می‌شود.
54+
55+
56+
پس آن جا نمی‌توانیم از `event.preventDefault()` استفاده کنیم -- بسیار دیر است و تاثیری نخواهد داشت.
5557
```
5658
5759
## Events: cut, copy, paste
5860
59-
These events occur on cutting/copying/pasting a value.
61+
این eventها زمان cut کردن/copy کردن/paste کردن یک مقدار اتفاق می‌افتند.
6062
61-
They belong to [ClipboardEvent](https://www.w3.org/TR/clipboard-apis/#clipboard-event-interfaces) class and provide access to the data that is cut/copied/pasted.
63+
ان‌ها به [ClipboardEvent](https://www.w3.org/TR/clipboard-apis/#clipboard-event-interfaces) class تعلق دارند و دسترسی به داده‌ای را که cut/copy/paste شده را فراهم می‌کنند.
6264
63-
We also can use `event.preventDefault()` to abort the action, then nothing gets copied/pasted.
65+
همچنین می‌توانیم برای لغو یک action از `event.preventDefault()` استفاده کنیم، آنگاه هیچ چیز copy/paste نمی‌شود.
6466
6567
For instance, the code below prevents all `cut/copy/paste` events and shows the text we're trying to cut/copy/paste:
6668

0 commit comments

Comments
 (0)